Thread overview | |||||
---|---|---|---|---|---|
|
October 13, 2005 Implicit ulong literals no longer? | ||||
---|---|---|---|---|
| ||||
Oops, hit the wrong 'group before. Let's try again....
I noticed that the spec for integer literals has changed. Decimal integer literals without the U suffix are now always int or long, never ulong. But why?
Previously, this line would have compiled:
ulong ul = 18446744073709551615;
I did notice, in the change log for 0.105
"Changed integral literal type determination to match C99 6.4.4.1."
which I'm guessing is something to do with it. But I don't see the point of this change. The "looks like C, acts like C" principle doesn't seem to be at work here, since the subset of cases that are still allowed seem to have the same behaviour specified as they did under the old spec. I certainly don't see any bug that allowing the above line could cause.
Stewart.
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------
My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
|
October 16, 2005 Re: Implicit ulong literals no longer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:diltob$1ku9$2@digitaldaemon.com... > I noticed that the spec for integer literals has changed. Decimal integer literals without the U suffix are now always int or long, never ulong. But why? > > Previously, this line would have compiled: > > ulong ul = 18446744073709551615; > > I did notice, in the change log for 0.105 > > "Changed integral literal type determination to match C99 6.4.4.1." > > which I'm guessing is something to do with it. But I don't see the point of this change. The "looks like C, acts like C" principle doesn't seem to be at work here, since the subset of cases that are still allowed seem to have the same behaviour specified as they did under the old spec. I certainly don't see any bug that allowing the above line could cause. I think this will reduce bugs with inadvertent signed/unsigned confusion. |
November 04, 2005 Re: Implicit ulong literals no longer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote: > "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message > news:diltob$1ku9$2@digitaldaemon.com... <snip> >> Previously, this line would have compiled: >> >> ulong ul = 18446744073709551615; >> >> I did notice, in the change log for 0.105 >> >> "Changed integral literal type determination to match C99 6.4.4.1." <snip> > I think this will reduce bugs with inadvertent signed/unsigned confusion. Can you give an example of such a bug? Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. |
Copyright © 1999-2021 by the D Language Foundation