2 registered members (AndrewAMD, TipmyPip),
13,353
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Formatting Syntax
[Re: sheefo]
#115821
03/07/07 12:39
03/07/07 12:39
|
Joined: Jan 2006
Posts: 1,829 Neustadt, Germany
TWO

Serious User
|

Serious User
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
|
I don't use Lite-C, but
1) STRUCT *Pointer; because then you protect yourselfe from the mistake: STRUCT* Pointer1, Pointer2; where 2 is no pointer because of the missing *
2) Pointer->x for sure, the spaces just take more time to write, while it's not better readable ( function foo(var Baa){} without whitespaces in the params, too )
3) Names: There is no best way; You can name members of strucs with m_ or write the names like I do ' function Net_ClVoiceGetVoiceDevice(ExempleVar); ' or write all names big or make struct names big, like the engine ones (VECTOR, STRING,...)
That's all up to you. But I think a notation like the type, ptr prefix (var *VPrtGameName;) or such things make programming crazy, it makes the code unreadable.
Every programmer has it's own preferences.
|
|
|
Re: Formatting Syntax
[Re: TWO]
#115822
03/07/07 13:43
03/07/07 13:43
|
Joined: Jul 2006
Posts: 783 London, UK
sheefo
OP
User
|
OP
User
Joined: Jul 2006
Posts: 783
London, UK
|
Thanks for sharing you coding style, even though you say you don't use lite-C... and C or C++ as well I guess...? You reminded me of another thing, to do with structs. I would like to know how people define structs (or functions even)? Style 1 Code:
struct myStruct { int attr; };
Style 2 Code:
struct myStruct { int attr; };
I use Style 2 
|
|
|
Re: Formatting Syntax
[Re: sheefo]
#115824
03/08/07 00:22
03/08/07 00:22
|
Joined: Mar 2007
Posts: 4 New York, NY
DGuy
Guest
|
Guest
Joined: Mar 2007
Posts: 4
New York, NY
|
I actually use: Code:
struct myStruct { int attr; };
But, having said that, my only advice to someone concerned about layout style would be: 1) Keep your code readable (Don't be afraid of whitespace!) 2) Choose a style that you like, and use it consistantly. HTH
|
|
|
|