Re: Compiler error or? Microsoft VC++ v6.0

From: Hendrik Schober (SpamTrap_at_gmx.de)
Date: 02/17/04


Date: Tue, 17 Feb 2004 22:51:04 +0100

Torstein Hansen <torsteinRemoveThis@hansen.as> wrote:
> "Ron Natalie" <ron@sensor.com> wrote in message
> news:403282f0$0$139$9a6e19ea@news.newshosting.com...
> >
> > "Torstein Hansen" <torsteinRemoveThis@hansen.as> wrote in message
> news:kpvYb.464$72.135468032@news.telia.no...
> >
> > > But in this code it's not the literal 0, rather
> > > const unsigned long u0 = 0
> > >
> > That's good enough. The rule says that a null pointer constant is a
> integer
> > constant expression evaluating to zero. A const variable initialized
> with a
> > constant qualifies as a constant expression.
> >
>
> Right - I'll just have to accept the rule. Even though it made for some
> long deep looks into the code to figure out what happened...

  Make your ctors 'explicit' except on
  very rare occasions. This takes care
  of many such issues.

> Thanks all...
>
> Torstein

  Schobi

-- 
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org
"Sometimes compilers are so much more reasonable than people."
  Scott Meyers


Relevant Pages

  • Re: Compiler error or? Microsoft VC++ v6.0
    ... The rule says that a null pointer constant is a ... > constant expression evaluating to zero. ... > constant qualifies as a constant expression. ...
    (microsoft.public.vc.language)
  • Re: segfault on strtok
    ... >>A constant expression with a value of zero, ... > I was looking at the standard when I wrote it. ... > integer which is zero is a null pointer constant if cast to void *. ...
    (comp.lang.c)
  • Re: segfault on strtok
    ... > integer which is zero is a null pointer constant if cast to void *. ... > a pointer type. ... An integer constant expression with the value 0, ...
    (comp.lang.c)
  • Re: offsetof() macro
    ... (If I were designing the language from scratch, ... Using 0 in a pointer context would be a constraint error. ... have said "An integer constant 0 is a valid null pointer constant. ... And also the standard says that a constant expression ...
    (comp.lang.c)
  • Re: Compiler error or? Microsoft VC++ v6.0
    ... constant expression evaluating to zero. ... constant qualifies as a constant expression. ...
    (microsoft.public.vc.language)