POV-Ray : Newsgroups : povray.programming : HF height: bug report : Re: HF height: bug report Server Time
6 Oct 2024 16:14:36 EDT (-0400)
  Re: HF height: bug report  
From: Vadim Sytnikov
Date: 6 Aug 2001 08:50:54
Message: <3b6e92ae$1@news.povray.org>
There is a HUGE difference between the two.

On any machine, both 01 and 1 (decimal) get translated into
0x00000001 (hex).

While 'ab' may be translated into 0x00006261, or 0x00006162,
or god knows what. The Standard does not define that.

Somebody has pointed out that using multicharacter constants
would be OK in enums... Not quite so. Multicharacter constants
do not define lexical order. What you can (only!) do with enum
elements defined as multicharacter constants is to compare then
for equality; you cannot tell which is bigger and which is smaller.

"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:3b6e796a$1@news.povray.org...
> In article <3b6ddda7@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:
>
> >   Actually 01 is an octal number ;)
> >
> >   (In fact, that's another place where you can shoot yourself in the
foot
> > with C. You might sometimes write something like "i = 011;" to "indent"
the
> > number with other similar numbers and then you are surprised when the
> > program behaves very strangely...)
> >
> >   This is actually one place where the compiler assumes that the user
> > really wanted an octal number and that it wasn't just a mistake.
>
> Exactly.  And in my example (unlike 011) it wouldn't even make a
difference
> if one wrote 01 or 1.  So why does it make a difference if I write
'ab'? --
> Both are features of the language.  They are both a bit "unexpected", but
> still perfectly legal!
>
>
>     Thorsten
>
>
> ____________________________________________________
> Thorsten Froehlich, Duisburg, Germany
> e-mail: tho### [at] trfde
>
> Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.