This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: guile bugs
- To: Ken Raeburn <raeburn at raeburn dot org>
- Subject: Re: guile bugs
- From: Jim Blandy <jimb at red-bean dot com>
- Date: 25 Sep 1999 14:12:16 -0500
- Cc: scwm-discuss at SCWM dot MIT dot EDU, guile at sourceware dot cygnus dot com
- References: <qrru2oyxtr7.fsf@elwha.cs.washington.edu> <199909141442.JAA17962@vh213601.truman.edu> <qrraeqpy0pl.fsf@elwha.cs.washington.edu> <199909141624.LAA19039@vh213601.truman.edu> <qrrlna9w5az.fsf@elwha.cs.washington.edu> <199909142309.SAA01374@vh213601.truman.edu> <qrrvh9bu8rp.fsf@elwha.cs.washington.edu> <m34sgvcttc.fsf@savonarola.red-bean.com> <qrrvh9bl8ix.fsf_-_@elwha.cs.washington.edu> <86g10e7ur2.fsf@localhost.uni-trier.de> <tx17llnlgb8.fsf@raeburn.org>
> 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?