overwriting memory

J

Jorgen Grahn

Yes, it's highly confusing to use a C++ keyword in upper case, particularly
if you're stripping functionality out.
What I often to however is have a structure name in all-caps, and a
constructor for it using the same name, in lower case. So it looks rather
like a C++ call. Of course you initialise all the fields in the function.

Yes, it's IME rather common to have a constructor-like convention in C
code, even though you can't get that nice "if you see a Foo object,
you can be sure it has been properly constructed" feeling.

I don't understand your naming convention, though -- there is no
conflict between function names and struct tags, so why make them
different[1]?

/Jorgen

[1] Not that I make them the same -- I tend to use struct Foo and
foo_create() or foo_init() or something.)
 
M

Malcolm McLean

I don't understand your naming convention, though -- there is no
conflict between function names and struct tags, so why make them
different[1]?
I use all-caps for a structure, because it shouts IMBIG. It's a sort of
visual cue that you're dealing with a composite memory object.

I use all lower-case for functions which depend only on the standard
library (or on other functions where the source is supplied). I use mixed
case for functions which depend on non-standard third party libraries,
which for me normally means a windowing system of some level of abstraction.
 
I

Ike Naar

There was only one that was directly relevant, having been quoted
earlier. Richard uses only a mononym as identification, - perhaps he's
Javanese? :) When it's less clear than it is in this case, people
sometimes refer to him using some variant on "Richard NoName".

Richard Graeme Riley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,075
Messages
2,570,547
Members
47,197
Latest member
NDTShavonn

Latest Threads

Top