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: builtin_constant_p


	I consider __builtin_constant_p to be a function in the same vein
	as sizeof. 

Apparently this is because you have been using it in macros, without trying
to write the macros in a way that was safe against multiple evaluation of
the arguments.  This won't be a problem if you start using inline functions
instead, because the argument will only be evaluated once.

In any case, it sounds reasonable to treat __builtin_constant_p like
sizeof, however, if we do this, then it must be very clearly documented.
Otherwise, there is no way for the average user to know whether it evaluates
for side-effects of not (heck, I didn't even know that was deliberate).
At the minimum, there should be a comment in the code saying that side-effects
are being deliberately ignored.  I see that builtin_classify_type is doing
the same thing.  I think that should be commented too.  I think the rest of
the builtin functions should be performing side-effects.

Jim


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