Thread: Syntax questions

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    65

    Syntax questions

    Code:
    struct foo {}
    void bar(struct foo f) {}
    void bar2(foo f) {}
    void test(void) {}
    Is there a difference between having bar's parameter as "foo f" or "struct foo f"?
    Is having void in test different from having no parameters at all?
    If a function doesn't return anything, is it good practice to give it return as the last statement? E.g.
    Code:
    void x()
    {
    	return;
    }

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    1. No
    2. No
    3. Matter of style, but I'd leave it out

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You're missing a semicolon at the end of the struct definition.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Note that these questions may have different answers in C. They all seem to be related to differences between C and C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM