public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Warning on dangerous use of assert() ?
@ 2004-03-17 12:35 hartmut.schirmer
  2004-03-17 12:43 ` Dave Korn
  0 siblings, 1 reply; 2+ messages in thread
From: hartmut.schirmer @ 2004-03-17 12:35 UTC (permalink / raw)
  To: gcc

Hi,

does it make sense to add a warning to GCC to
avoid cases where the condition of an assert()
has side effect ?

I just found code like this

  assert(init_something());

failing in release mode ...

Thanks,
Hartmut






^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Warning on dangerous use of assert() ?
  2004-03-17 12:35 Warning on dangerous use of assert() ? hartmut.schirmer
@ 2004-03-17 12:43 ` Dave Korn
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Korn @ 2004-03-17 12:43 UTC (permalink / raw)
  To: gcc

 

> -----Original Message-----
> From: gcc-owner On Behalf Of hartmut.schirmer
> Sent: 17 March 2004 12:29

> Hi,
> 
> does it make sense to add a warning to GCC to avoid cases 
> where the condition of an assert() has side effect ?
> 
> I just found code like this
> 
>   assert(init_something());
> 
> failing in release mode ...
> 
> Thanks,
> Hartmut


  Sounds like an absolutely excellent idea to me; it's entirely in line with
warnings about assignments in if conditionals and so on.  People quite often
forget that asserts disappear in release builds.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....
 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-17 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-17 12:35 Warning on dangerous use of assert() ? hartmut.schirmer
2004-03-17 12:43 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).