Stewart Smith wrote:
> On Wed, Jul 08, 2009 at 10:56:05AM -0700, Brian Aker wrote:
>> 1) Don't use "struct" for a struct. This is C++, isn't needed at all.
> 
> The two possible exceptions I kind of like are if it's going over the wire or 
> to
> disk and is __attribute__ packed.

I usually use "struct" for POD, and "class" otherwise. It isn't required,
however, it is perfectly OK to write a POD using "class" as well.

>> 2) Don't use typedef with struct.
> 
> ...unless it's used to abstract a basic type (e.g. like in my_socket.h
> to get socket portability across UNIX and Win32).

I don't see a reason for this. Even the Linux API requires any C programmers to
write "struct whatever", so it is just as easy to use "struct whatever" in the C
code, and "whatever" in C++ code.

Just my few cents,
Mats Kindahl
-- 
Mats Kindahl
Senior Software Engineer
Database Technology Group
Sun Microsystems

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to