Thread overview
wchar assignments
Nov 17, 2004
Thomas Kuehne
dchar assignments (WAS Re: wchar assignments)
Nov 17, 2004
Thomas Kuehne
Nov 19, 2004
Walter
Nov 19, 2004
Thomas Kuehne
Nov 22, 2004
Walter
November 17, 2004
Constant assignments to wchar allow values greater than wchar.max. http://svn.kuehne.cn/dstress/nocompile/wchar_04.d

Constant assignments to wchar allow values smaller than wchar.min. http://svn.kuehne.cn/dstress/nocompile/wchar_06.d

Thomas

November 17, 2004
Thomas Kuehne schrieb am Wed, 17 Nov 2004 09:45:12 +0100:
> Constant assignments to wchar allow values greater than wchar.max. http://svn.kuehne.cn/dstress/nocompile/wchar_04.d
>
> Constant assignments to wchar allow values smaller than wchar.min. http://svn.kuehne.cn/dstress/nocompile/wchar_06.d

dchar has the same problems.

http://svn.kuehne.cn/dstress/nocompile/dchar_04.d http://svn.kuehne.cn/dstress/nocompile/dchar_06.d

Thomas
November 19, 2004
I don't believe this is a bug. It is analogous to:

    byte b = 1000;

which is allowed as well.

"Thomas Kuehne" <thomas-dloop@kuehne.thisisspam.cn> wrote in message news:n9ur62-jt9.ln1@kuehne.cn...
>
> Thomas Kuehne schrieb am Wed, 17 Nov 2004 09:45:12 +0100:
> > Constant assignments to wchar allow values greater than wchar.max. http://svn.kuehne.cn/dstress/nocompile/wchar_04.d
> >
> > Constant assignments to wchar allow values smaller than wchar.min. http://svn.kuehne.cn/dstress/nocompile/wchar_06.d
>
> dchar has the same problems.
>
> http://svn.kuehne.cn/dstress/nocompile/dchar_04.d http://svn.kuehne.cn/dstress/nocompile/dchar_06.d
>
> Thomas


November 19, 2004

Can you please comment on following findings?

fail:
	short A = 32768;	// short.max+1
	byte  B = 128;		// byte.max+1
	char  C = 256;		// char.max+1
pass:
	short a = -32769;	// short.min-1
	byte  b = -129;		// byte.min-1
	char  c = -1;		// char.min-1
	wchar D = 655536;	// wchar.max+1
	wchar d = -1;		// wchar.min-1
	dchar E = 1114112;	// dchar.max+1
	dchar e = -1;		// dchar.min-1

The only documentation I found for this was "lex.html".

In fact some funny consequences occur. According to the integer
resolution table "-1" is not considered to be an integer literal
- e.g. ints have a range from 0 to int.max. This explains why no lower
borders are checked. But why are the upper borders of short, byte and
char checked where as neither (d/w)char's upper nor lower border is
checked?

Just for clarification: I am only talking about constant assignments known at compile time, not about any overflow issues during the execution.

Thomas

Walter schrieb am Fri, 19 Nov 2004 14:18:28 -0800:
> I don't believe this is a bug. It is analogous to:
>
>     byte b = 1000;
>
> which is allowed as well.
>
>> Thomas Kuehne schrieb am Wed, 17 Nov 2004 09:45:12 +0100:
>> > Constant assignments to wchar allow values greater than wchar.max. http://svn.kuehne.cn/dstress/nocompile/wchar_04.d
>> >
>> > Constant assignments to wchar allow values smaller than wchar.min. http://svn.kuehne.cn/dstress/nocompile/wchar_06.d
>>
>> dchar has the same problems.
>>
>> http://svn.kuehne.cn/dstress/nocompile/dchar_04.d http://svn.kuehne.cn/dstress/nocompile/dchar_06.d
November 21, 2004
Walter wrote:

> I don't believe this is a bug. It is analogous to:
> 
>     byte b = 1000;
> 
> which is allowed as well.

gdc 0.8 doesn't like that code:
"cannot implicitly convert expression 1000 of type int to byte"

--anders
November 22, 2004
I obviously need to clean this up.

"Thomas Kuehne" <thomas-dloop@kuehne.thisisspam.cn> wrote in message news:rra272-427.ln1@kuehne.cn...
>
>
> Can you please comment on following findings?
>
> fail:
> short A = 32768; // short.max+1
> byte  B = 128; // byte.max+1
> char  C = 256; // char.max+1
> pass:
> short a = -32769; // short.min-1
> byte  b = -129; // byte.min-1
> char  c = -1; // char.min-1
> wchar D = 655536; // wchar.max+1
> wchar d = -1; // wchar.min-1
> dchar E = 1114112; // dchar.max+1
> dchar e = -1; // dchar.min-1
>
> The only documentation I found for this was "lex.html".
>
> In fact some funny consequences occur. According to the integer
> resolution table "-1" is not considered to be an integer literal
> - e.g. ints have a range from 0 to int.max. This explains why no lower
> borders are checked. But why are the upper borders of short, byte and
> char checked where as neither (d/w)char's upper nor lower border is
> checked?
>
> Just for clarification: I am only talking about constant assignments known at compile time, not about any overflow issues during the execution.
>
> Thomas
>
> Walter schrieb am Fri, 19 Nov 2004 14:18:28 -0800:
> > I don't believe this is a bug. It is analogous to:
> >
> >     byte b = 1000;
> >
> > which is allowed as well.
> >
> >> Thomas Kuehne schrieb am Wed, 17 Nov 2004 09:45:12 +0100:
> >> > Constant assignments to wchar allow values greater than wchar.max. http://svn.kuehne.cn/dstress/nocompile/wchar_04.d
> >> >
> >> > Constant assignments to wchar allow values smaller than wchar.min. http://svn.kuehne.cn/dstress/nocompile/wchar_06.d
> >>
> >> dchar has the same problems.
> >>
> >> http://svn.kuehne.cn/dstress/nocompile/dchar_04.d http://svn.kuehne.cn/dstress/nocompile/dchar_06.d