Thread overview | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 25, 2004 Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
void main() { int i, j; int k = (i)+j; } [dmd 0.96] outputs: C style cast deprecated, use cast(i)(j) |
July 26, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Zaitseff | "Ilya Zaitseff" <sark7@mail333.com> wrote in message news:opsbpwecsuaaezs2@ilya.tec.amursk.ru... > void main() > { > int i, j; > int k = (i)+j; > } > > [dmd 0.96] outputs: C style cast deprecated, use cast(i)(j) Such parsing ambiguities are why C style casts are deprecated <g>. (It is parsed as (i)(+j), i.e. the + is seen as the unary plus operator.) |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | On Mon, 26 Jul 2004 10:07:28 -0700, Walter wrote: > "Ilya Zaitseff" <sark7@mail333.com> wrote in message news:opsbpwecsuaaezs2@ilya.tec.amursk.ru... >> void main() >> { >> int i, j; >> int k = (i)+j; >> } >> >> [dmd 0.96] outputs: C style cast deprecated, use cast(i)(j) > > Such parsing ambiguities are why C style casts are deprecated <g>. (It is > parsed as (i)(+j), i.e. the + is seen as the unary plus operator.) Does this mean the we can never have the construct ... '(' <identifier> ')' <operand> <expression> in D? -- Derek Melbourne, Australia 27/Jul/04 11:33:09 AM |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | if the "unary plus" operator didn't exist, we wouldn't have this problem ;) what the hell is it for anyway? jill wants to know too. |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | "Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:ce4bnm$1lla$1@digitaldaemon.com... > if the "unary plus" operator didn't exist, we wouldn't have this problem ;) > > what the hell is it for anyway? jill wants to know too. For completeness. It should be overloadable, though. |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:ce4bgd$1lir$1@digitaldaemon.com... > On Mon, 26 Jul 2004 10:07:28 -0700, Walter wrote: > > > "Ilya Zaitseff" <sark7@mail333.com> wrote in message news:opsbpwecsuaaezs2@ilya.tec.amursk.ru... > >> void main() > >> { > >> int i, j; > >> int k = (i)+j; > >> } > >> > >> [dmd 0.96] outputs: C style cast deprecated, use cast(i)(j) > > > > Such parsing ambiguities are why C style casts are deprecated <g>. (It is > > parsed as (i)(+j), i.e. the + is seen as the unary plus operator.) > > Does this mean the we can never have the construct ... > > '(' <identifier> ')' <operand> <expression> > > in D? You will once I take out C style casts completely. But unlike C, you never need to enclose an identifier in redundant parens, so it isn't a problem. (It's needed in C because of macro arguments.) |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | In article <ce4bnm$1lla$1@digitaldaemon.com>, Jarrett Billingsley says... > >if the "unary plus" operator didn't exist, we wouldn't have this problem ;) Well, actually, we'd still have the problem with unary minus. This problem will go away in time, once C-style casts change from "deprecated" to "illegal". (But I'd still like to know what unary plus is for, given that we can't overload it to do anything useful). Jill |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <ce4r8j$1s0a$1@digitaldaemon.com>, Walter says... >> if the "unary plus" operator didn't exist, we wouldn't have this problem >;) >> >> what the hell is it for anyway? jill wants to know too. > >For completeness. It should be overloadable, though. Cool. What would you call it though? opDoNothing()? opTrivial()? Jill :) |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote: >>> "Ilya Zaitseff" <sark7@mail333.com> wrote in message >>> news:opsbpwecsuaaezs2@ilya.tec.amursk.ru... >>> >>>> void main() >>>> { >>>> int i, j; >>>> int k = (i)+j; >>>> } >>>> >>>> [dmd 0.96] outputs: C style cast deprecated, use cast(i)(j) <snip> > You will once I take out C style casts completely. But unlike C, you never > need to enclose an identifier in redundant parens, so it isn't a problem. > (It's needed in C because of macro arguments.) I personally don't see much difficulty in trying to parse it as an AddExpression first ... but yes, getting rid of C casts is the way to go. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
July 27, 2004 Re: Deprecated cast bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arcane Jill | > Well, actually, we'd still have the problem with unary minus.
agh forgot about that one..
|
Copyright © 1999-2021 by the D Language Foundation