Why is char initialized to 0xFF ?

KnightMare black80 at bk.ru
Sun Jun 9 08:38:45 UTC 2019


On Sunday, 9 June 2019 at 08:26:45 UTC, Mike Parker wrote:

> Not at all. It's quite practical for debugging. Uninitialized 
> variables are a pain in C and C++. Default initializing to 
> invalid values makes them stand out in the debugger. The 
> drawback is that the integrals (and bool) have no invalid 
> value, so we're stuck with 0 (and false).

I agree that memory must be initialized unless otherwise stated.
I disagree that garbage(uninit value) should be FF and NaN.
again "all zeroes" is best and right thing.
people are the main resource, they have expectations, the expect 
zeroes, u can poll they "what values shuold be used for 
unitialized vars?" and if u think about it u will answer.. 
what?.. any men on the street. no, in IT-park.

imo coz nobody used FF and Nan in D-code now (so, the default is 
FF, so I just do "ch += 1" and I've got 00! I am cool hacker!), 
we can change it to most expecting values (I think it zero). In 
any case we can do poll between D-users for beggining.
or lets setup tagline for D "We have our own way, dont boomboom 
our brain!". joke. maybe a little bit trolled.


More information about the Digitalmars-d mailing list