autoconf
[Top][All Lists]
Advanced

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

Re: AC_LANG_SOURCE(C++) and exit


From: Raja R Harinath
Subject: Re: AC_LANG_SOURCE(C++) and exit
Date: 07 Nov 2000 15:48:16 -0600
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi,

Pavel Roskin <address@hidden> writes:
> Hello, Raja!
> > AC_LANG_SOURCE(C++) uses 
> > 
> >   extern "C" void exit (int);
> 
> I remember we already discussed it. I believe that there are many issues
> here.
> 
> 1) "return" is rumored to be unportable/unreliable, but does it apply to
> C++? I doubt it. It's probably better to use "return" for C++.
> 
> 2) Even if we go with "exit" we should avoid declaring it by all costs.

I agree.
 
> 3) There macro checks carefully "#ifdef __cplusplus". What happens if
> __cplusplus is not defined? Nothing! It should be an error, unless I'm
> missing something.

I think this was because originally AC_LANG_SOURCE(C++) was the same
as AC_LANG_SOURCE(C).

> There are many places where `extern "C"' is used. I hope that C++ is not
> that broken as C. It should be fair to change the approach taken by
> Autoconf to adapt it to the C++ ideology. I.e. if we use C++ and we cannot
> find a declaration of foo() we shouldn't use it at all.

The approach used in AC_CHECK_FUNC etc. should be OK, since they don't
include any headers except assert.h.  (The part about finding a
declaration of foo() is trickier -- the prototype includes throw()
specifications.)

I think problems arises when you have conflicting declarations.  For
example, when you do AC_CHECK_SIZEOF.  The declaration of exit() from
AC_LANG_SOURCE may/will conflict with the declaration in stdlib.h.

The above is also true for C, of course.  The funny part is that for
C, autoconf doesn't declare 'exit', but it does for C++, where the
chances of getting a conflict are so much higher.

> We need someone with a good C++ background who could rewrite
> AC_LANG_SOURCE(C++) and test it on many compilers.
> 
> I hope that you will find time to create a well tested patch and
> submit it to address@hidden

That takes me out of the contention :-) I've access to GCC, and under
duress, Sun C++.

- Hari
-- 
Raja R Harinath ------------------------------ address@hidden
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]