This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Porting Questions

On Wed, Jun 27, 2001 at 02:45:22PM -0400, David A. Greene wrote:
> - There are many places where gcc's __builtin_* functions
> are called.  Obviously, we don't have these.  Right now
> I've #ifdef'd the code to call __builtin_* when __GNUC__
> is defined and * otherwise.  I don't like this solution
> in the long run, so would an additional test for these
> functions and #define be appropriate?  For example, test
> for __builting_alloca and #define ALLOCA_FUNCTION to
> alloca or __builtin_alloca as appropriate.

Testing is probably not unreasonable; for those systems where running the
tests is either slow and/or pointless, there should probably be some way
to force the results of the tests outright.

Rather than additional macros, I'd recommend leaving the builtins spelled
as they are, and if there is no (say) __builtin_alloca, then and only then
adding a macro, like

    #define __builtin_alloca alloca

(BTW, you mentioned you had some extra autoconf work in your local tree,
I think.  Would you be adverse to contributing them to the public tree?
I'm always up for making the configury smarter.)

> - I have the same problem with NULL.  Our compiler doesn't
> like the assignment of (void *)(0) to non-void pointers.

Good, since (void*)0 is an invalid definition for NULL.  I hope we're not
doing that anywhere in libstdc++.

What about straight 0 or 0L instead?  There are potential overloading
problems there, but at least it's legal.

GCC defines a magic __null for precisely these reasons... there's an example
of how to define a magic NULL in userland on the libstdc++ website, but
it needs an empty default ctor added.

> Now, the big whopper:

Can't help you there, unfortunately.  After the discussion involving
definitions, specializations, instantiations, and AIX freaky-weirdness,
my understanding of templates has regressed.  I don't think I understand
them anymore.  :-)


Would I had phrases that are not known, utterances that are strange, in
new language that has not been used, free from repetition, not an utterance
which has grown stale, which men of old have spoken.
                                     - anonymous Egyptian scribe, c.1700 BC

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]