Func declaration without variables

Probably another pointless question, but…

I notice that you’re declarations are all unnamed i.e. ret_type func_name( var_type,…) rather than named ret_type func_name( var_type var_name, …).

Just wondering if there’s a reason for that or if it’s just a programming habit?

Also you name a variable with it’s type name [BullCowCount BullCowCount], which is clearly legal if it compiles, but why is it a good idea?


Skipping function parameter names in a declaration is just a preference.
And I think declaring an object with the same name as its class (like BullCowCount BullCowCount;) is never a good idea :wink:

1 Like

That’s what I thought, but I haven’t written any real code since the 90’s, and just wanted to make sure that c++11 hadn’t driven everyone crazy :stuck_out_tongue_winking_eye: I kind of like using variable declarations in functions as part of documentation.

// Light the fire in the fireplace
void CFirePlace::LightFire( const CMatch & Match )


Privacy & Terms