This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: Add uninitialized attribute?


H.J. Lu wrote:

> void *undef __attribute__ ((uninitialized)); // Or something similar
> 
> foo (undef);
> 
> Compiler can pass some junk to foo.

I don't think that's a very good idea.  If we need this, which I doubt,
it should be something like a new __undefined__ keyword, that expands to
 an undefined value.  In C++, a syntax like __undefined__<X>() would be
plausible; I'm not sure there's a good C syntax.  Perhaps you could do
what tgmath does.

I guess if you had this, you could use it in place of the attribute;

  int i = __undefined__<int>();

would serve to indicate that you were knowingly not initializing i.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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