This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


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

Re: guile bugs



> I think the idea of making SCM a struct or union makes more sense.
> Sucks for performance, though.  Well, in the normal case.  Do you mind
> having the type checking be dependent on gcc?
> 
>     #if __GNUC__ >= 2 && __GNUC_MINOR__ >= whatever...
>     typedef union { long n; } __attribute__ ((transparent_union)) SCM;
>     #define SCM_BITS(X) ((X).n)
>     #else
>     typedef long SCM;
>     #define SCM_BITS(X) (X)
>     #endif
> 
> A SCM object would get passed as a long, always.  Under gcc, using it
> as a numeric value will not work.  This only works with recent enough
> versions of gcc, of course, but transparent_union has been in there
> for quite a while.  And for people with ancient versions of gcc, or
> without gcc, they just don't get the type checking; they still get the
> same calling convention, so even mixing gcc- and non-gcc-compiled code
> works fine.

Unfortunately, transparent unions are still *returned* using the
conventions for unions.  Which will definitely hurt performance.

Damn --- this would have been so great.  Perfect, no-overhead
type-checking for anyone using GCC.

Ken, if I asked the EGCS folks about it, and they approved in
principle, would you be able to write a patch for GCC to make it
return, as well as pass, transparent unions as if they had the type of
the union's first element?

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