namespaces in C?

B

BGB / cr88192

Serve Laurijssen said:
Interesting article on namespaces in C++ and why not to add them to C.
Read the very last sentence first and then if you're still interested read
the full article.

http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=286

yep...

I don't use namespaces in the rare cases I use C++, mostly since, in their
full form, they would mess up my present automated source-processing tools
(since I am too lazy sometimes...).

so, when I use C++, mostly it is just C-style coding practices, but maybe
with "some" classes or operator overloading in the mix somewhere.


the per-class header files, and per-class source-files style, IMO, is just
totally bizarre to me personally (looks too damn much like Java for my
tastes...).

well, that and I also note that many C++ dev's can't seem to figure this out
either, and so end up just writing the .cpp files, and including all of the
..cpp files into a single massive source file (granted, there are merits to
this as well...).


but, "single class per file", would probably not mix so well with me, as I
already have too many text editors open at a time with C, and this style
would likely make this problem easily several times worse...

actually, I personally don't understand this, as for me at least it doesn't
really help me understand the codebase really any better than more
conventional approaches (only that it leads to a frenzy of opening and
closing text editors trying to figure out how any of this works...).

with typical C codebases, I am able to look at a much smaller number of
files, and just sort of skim though the files to get a general overview of
how it all works and fits together, without nearly so much of a text-editor
frenzy...


and, as well, even just with me, I often end up with 30-50 text editors open
in the process of working on something, so I don't see how the style would
help "that" much with coding anyways.

granted, not like I make C files super huge though, as my usual "rule of
thumb" is for around 500-1000 lines, as too much larger and the source files
start getting difficult to manage (too much scrolling), and so I end up
often splitting files like this...

or such...
 

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,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top