C++ Syntax

This is a discussion on C++ Syntax within the C++ Programming forums, part of the General Programming Boards category; I am having trouble with some existing C++ that I have been asked to modify. Can someone please explain the ...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    1

    C++ Syntax

    I am having trouble with some existing C++ that I have been asked to modify. Can someone please explain the following code to me please?

    Code:
    extern "C" void SpiPutword( Uint16 w )
    {
        Lcd().ProcessDataWord( w );
    }
    I don't recall coming across funtion1().funtion2() before...

    The above code was taken from a VS2005 C++ MFC project. Basically it's suppose to be a test harness (PC emulator) for a touchscreen wall controller (ie., air conditioner wall controller).

    Any suggestions or advice would be much appreciated.

    Thanks.

  2. #2
    Registered User
    Join Date
    Aug 2011
    Location
    Montreal, Quebec, Canada
    Posts
    73
    Lcd() returns an object that contains function ProcessDataWord().

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,628
    Quote Originally Posted by skrep
    I don't recall coming across funtion1().funtion2() before...
    You might be more familiar with:
    Code:
    x = Lcd();
    x.ProcessDataWord( w );
    The code you read merely eliminated the variable x by chaining the function calls.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Never seen this syntax before. Help?
    By yougene in forum C Programming
    Replies: 8
    Last Post: 06-02-2009, 02:50 AM
  2. what must be syntax?
    By shwetha_siddu in forum Tech Board
    Replies: 15
    Last Post: 04-30-2008, 09:35 AM
  3. Help with syntax please.
    By chrismcc35 in forum C Programming
    Replies: 4
    Last Post: 03-04-2008, 06:18 PM
  4. Syntax help
    By xplod in forum C++ Programming
    Replies: 1
    Last Post: 02-27-2006, 12:34 AM
  5. Syntax Help Please
    By misplaced in forum C++ Programming
    Replies: 3
    Last Post: 04-22-2005, 07:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21