[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: usage of reserved C++-keyword in cthreads.h



On Wed, Feb 13, 2002 at 12:37:00PM -0800, Thomas Bushnell, BSG wrote:
> Jeff Bailey <jbailey@nisa.net> writes:
> 
> > It's no harder or more complicated than making a header file work with
> > both K&R and ANSI, especially now that C++ is standardized.  It's just
> > a matter of whether the authors wanted to do so or not.
> 
> No, no, no, you've missed the point entirely.

> Indeed, there is even a construct in C++, something like
> 
> extern "C" {
> }
> 
> which could even be profitably used for *just this purpose*, and yet,
> it isn't.  If the designers of the language lied to you, and said "you
> can just include any C header and it will work", then don't blame the
> authors of those *headers* for the designer's lie.
> 
> I think it would be very easy for C++ to fix the damn parser so that
> within the above construct (or one like it) it accepts C syntax.  But
> instead, for some reason, everybody who just wants to write a C
> program is flamed incessently for an inadequacy in C++!

C++ is an _extention_ of C. IMHO, it is very easy for C programs to 
accomodate C++ by using the

#ifdef c_plusplus
extern "C" {
#endif

and by not using reserved keywords. It's not that difficult!

It is a lot more difficult for C++ parser to accomodate 
non-portable C code. IMO, all proper C code should compile with
a C++ compiler.

This is just my 2 cents, but this opinion is quite popular amonst
coders and most source that doesn't do this, like cthreads, is
simply not and if not fixed, it is replaced by more compatible
libraries like pthreads.

- Adam



Reply to: