Understanding char*

D

Duane Hebert

Yeah, I know. But I think it's unfortunate when projects that *could*
use modern C++ don't, and do things the hard way instead. I question the
validity of the reasons for this. Is there really a good reason to
forbid, e.g., templates in a C++ program in this day and age?

Theoretically no but if the compiler that you're stuck with using has broken
support for templates...
 
K

Kevin Goodsell

Duane said:
Theoretically no but if the compiler that you're stuck with using has broken
support for templates...

Well, it's not necessarily one compiler. If you are targeting multiple
systems, you may be stuck with the "lowest common denominator",
unfortunately. I understand this, but what I don't quite understand is
what standard some people are apparently using to determine what the
lowest common denominator is.

Take the Mozilla project, for example. I love Mozilla. I use Firebird
for all my browsing and Thunderbird for mail and news. But I think their
coding standards are a joke. Here's a few links:

http://www.mozilla.org/hacking/mozilla-style-guide.html
http://www.mozilla.org/hacking/portable-cpp.html

And here's a few examples of the rules:

* Don't use NULL for pointers. On some systems it's declared as void *
and causes a compile warning when assigned to a pointer.

* Don't use templates.

* Don't use exceptions.

* Don't use namespaces.

* Don't put constructors in header files. (Because VC++ 1.5 can't handle it)

This seems crazy to me. Portable is one thing, but portable to ancient
compilers is another. They want it to be able to build for pretty much
any system - that's great, but is it necessary to restrict the language
that much? Considering the compilers that are available today, you'd
think they could allow the use of most language features with no
problems at all. gcc and Comeau come to mind - how many platforms do
they cover? If they could *only* build on those two compilers, I think
they'd still have pretty much the platform coverage they have now. And
if they were using the language rather than working around it, they'd
probably have fewer bugs.

I think we should demand compilers that support the actual language,
rather than restricting our use of the language to those features
vendors feel like supporting.

-Kevin
 
G

Greg Comeau

...Take .. Mozilla ... I think their
coding standards are a joke. Here's a few links:

http://www.mozilla.org/hacking/mozilla-style-guide.html
http://www.mozilla.org/hacking/portable-cpp.html

And here's a few examples of the rules:

* Don't use NULL for pointers. On some systems it's declared as void *
and causes a compile warning when assigned to a pointer.

* Don't use templates.

* Don't use exceptions.

* Don't use namespaces.

* Don't put constructors in header files. (Because VC++ 1.5 can't handle it)

This seems crazy to me. Portable is one thing, but portable to ancient
compilers is another. They want it to be able to build for pretty much
any system - that's great, but is it necessary to restrict the language
that much? Considering the compilers that are available today, you'd
think they could allow the use of most language features with no
problems at all. gcc and Comeau come to mind - how many platforms do
they cover? If they could *only* build on those two compilers, I think
they'd still have pretty much the platform coverage they have now. And
if they were using the language rather than working around it, they'd
probably have fewer bugs.

I think we should demand compilers that support the actual language,
rather than restricting our use of the language to those features
vendors feel like supporting.

It definitely *is* the case that many projects need to constrain
themselves as per the guidelines above. However, I don't think
that's the problem, that is, I think the problem is projects which
don't need such constrains to be tied down by them, coding standards
which take on lies of their own, coding standard which remain
stagnant, inapplying situations, etc. So sure, for many project,
it can make no sense at all, and doing something as you say just
might be the ticket.
 

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

Similar Threads


Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top