This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: C++ PATCH: Fix PR 288


On Sunday 18 February 2001 03:10, Mark Mitchell wrote:
> >>>>> "Doug" == Doug Gregor <gregod@cs.rpi.edu> writes:
>
>     Doug> This isn't a problem specific to the typeof extension,
>     Doug> however. Consider a similar code snippet with the same
>     Doug> problem:
>
>     Doug> struct S { int i; static const int s = sizeof(S::i); };
>
>     Doug> In general, the typeof extension need not be semantically
>     Doug> different from sizeof, but is many times more useful.
>
> I'm not sure exactly what point you're trying to make. :-)
>
> That use of `sizeof' isn't legal either, IIRC.
>
> However, maybe you're arguing that the `typeof' language extension is
> a good one, relative to some other language extensions?  That could
> well be.  Your example is indeed compelling.

Yes, the intended argument was that 'typeof' is an extremely useful language 
extension. It is also a safe extension to include because its arguments are 
semantically equal to those of sizeof() and its result is well-defined and 
obvious.

	Doug Gregor
	gregod@cs.rpi.edu


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