This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to implement `restrict' in C
- To: <egcs at cygnus dot com>
- Subject: Re: PATCH to implement `restrict' in C
- From: "Ross Smith" <ross dot s at ihug dot co dot nz>
- Date: Sat, 17 Oct 1998 15:25:52 +1300
From: Joe Buck <jbuck@synopsys.com>
>> 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 build.
>
>Ah, but they could have done this without asking people to change their
>code: 'assert' would expand to __assume if NDEBUG is defined. It isn't
>necessary to invent a new user-level construct.
I strongly disagree. It *is* necessary to invent a new user level
construct, because forcing the "assume" semantics to be coupled with
the standard "assert" semantics would be a Bad Thing.
This may come as a shock to some people, but not everyone believes
that "assert" is the be-all and end-all of debugging. Some of us
prefer to use more sophisticated instrumentation that can produce
more useful and flexible results than simple termination.
I think an "assume" instruction that can give the compiler information
it would not otherwise be aware of would be an extremely good idea. I
also think that forcing it to be coupled with the dumb, primitive
sledgehammer of "assert" would be an extremely bad idea.
(Somebody is going to reply "so define NDEBUG already". Why should I
have to do that to make a perfectly good program work?)
--
Ross Smith ................................... mailto:ross.s@ihug.co.nz
.............. The Internet Group, Auckland, New Zealand ..............
* * * * *
"Screw up your courage. You've screwed up everything else."