Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 03, 2004 integer literals - in binary | ||||
---|---|---|---|---|
| ||||
ok so all C based languages can do this: int x = 0xFF; //255 what about this: int x = 0b11111111; //255 this would be very useful especially for defining flags |
February 03, 2004 Re: integer literals - in binary | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | > int x = 0b11111111; //255 > > this would be very useful especially for defining flags > It's supported. Give it a try. -- Christopher E. Miller www.dprogramming.com |
February 03, 2004 Re: integer literals - in binary | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | imr1984 wrote: > ok so all C based languages can do this: > > int x = 0xFF; //255 > > what about this: > > int x = 0b11111111; //255 > > this would be very useful especially for defining flags > > Have a look at http://digitalmars.com/d/lex.html There look at Integer Literals -> binary D supports exactly the notation you suggest... Stephan |
February 03, 2004 Re: integer literals - in binary | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | AFAIUI, D already supports this, although I do not know the precise syntax "imr1984" <imr1984_member@pathlink.com> wrote in message news:bvo5a9$2mqs$1@digitaldaemon.com... > ok so all C based languages can do this: > > int x = 0xFF; //255 > > what about this: > > int x = 0b11111111; //255 > > this would be very useful especially for defining flags > > |
Copyright © 1999-2021 by the D Language Foundation