PATCH to implement `restrict' in C
Lassi A. Tuura
lat@iki.fi
Fri Oct 16 07:00:00 GMT 1998
|> I believe that it should be possible to make gcc to take advantage of some simple
|> assertions (like assert(a>0);) and should bring quite clean and natural way
|> how to write informations to optimizer... Gcc actually does it in conditions,
|> so makng assertions act like "conditions" should do the job.
The newest Microsoft Visual C++ (6.0) seems to have a new construct
`__assume(expr)'. What they recommend is to replace `assert' in with
`__assume(expr)' in non-debug builsd. The compiler can exploit the
assmuption in optimisations. That looks like a neat and extensible
solution -- if the expression is not something the compiler can
understand, it can just ignore it. If it can make use of it, all the
better.
Cheers,
//lat
--
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead. --RFC1925, "The Twelve Networking Truths"
More information about the Gcc
mailing list