Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 29, 2015 #ifdef hell | ||||
---|---|---|---|---|
| ||||
https://www.cqse.eu/en/blog/living-in-the-ifdef-hell/ Another voice on what is wrong with the snarl of #ifdef's. |
October 29, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 10/29/2015 3:18 PM, Walter Bright wrote: > https://www.cqse.eu/en/blog/living-in-the-ifdef-hell/ > > Another voice on what is wrong with the snarl of #ifdef's. Reddit: https://www.reddit.com/r/programming/comments/3qo79b/living_in_the_ifdef_hell/ |
October 29, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, 29 October 2015 at 22:18:11 UTC, Walter Bright wrote:
> https://www.cqse.eu/en/blog/living-in-the-ifdef-hell/
>
> Another voice on what is wrong with the snarl of #ifdef's.
how does this differ from static if and version(x) hell?
|
October 29, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsw0x | On 10/29/2015 3:23 PM, rsw0x wrote:
> On Thursday, 29 October 2015 at 22:18:11 UTC, Walter Bright wrote:
>> https://www.cqse.eu/en/blog/living-in-the-ifdef-hell/
>>
>> Another voice on what is wrong with the snarl of #ifdef's.
>
> how does this differ from static if and version(x) hell?
We advise people not to use static if to do what version(x) eschews, and suggest better alternatives.
|
October 29, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, 29 October 2015 at 23:10:38 UTC, Walter Bright wrote: > On 10/29/2015 3:23 PM, rsw0x wrote: >> On Thursday, 29 October 2015 at 22:18:11 UTC, Walter Bright wrote: >>> https://www.cqse.eu/en/blog/living-in-the-ifdef-hell/ >>> >>> Another voice on what is wrong with the snarl of #ifdef's. >> >> how does this differ from static if and version(x) hell? > > We advise people not to use static if to do what version(x) eschews, and suggest better alternatives. Ha, I wish! In fact, you are currently arguing for people to write *more* version statements over at the https://github.com/D-Programming-Language/dmd/pull/5231 — David |
October 29, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On Thursday, 29 October 2015 at 23:14:26 UTC, David Nadlinger wrote: > On Thursday, 29 October 2015 at 23:10:38 UTC, Walter Bright wrote: >> We advise people not to use static if to do what version(x) eschews, and suggest better alternatives. > > Ha, I wish! > > In fact, you are currently arguing for people to write *more* version statements over at the https://github.com/D-Programming-Language/dmd/pull/5231 The idea is that you get rid of all of the &&ing and ||ing that tends to make #ifdefs really hard to follow and error-prone. And by having each version fully separate, changing one version won't break another. Now, that comes at the cost of forcing you to duplicate a lot of code, which almost everyone other than Walter thinks is worse than the risks associated with merging similar versions together, but as far as I can tell, Walter is completely consistent in his arguments. - Jonathan M Davis |
October 30, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 10/29/2015 4:14 PM, David Nadlinger wrote: > In fact, you are currently arguing for people to write *more* version statements > over at the https://github.com/D-Programming-Language/dmd/pull/5231 I presented several ways to avoid using complex version statements. I might add that over time, I'd been removing #if's and #ifdef's from the dmd front end source code. The results were very satisfactory - the code was easier to read, understand and maintain. It also made running magicport on the code practical. I've been slowly doing the same to the back end. |
October 30, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2015-10-30 03:01, Walter Bright wrote: > I might add that over time, I'd been removing #if's and #ifdef's from > the dmd front end source code. The results were very satisfactory - the > code was easier to read, understand and maintain. It also made running > magicport on the code practical. The DMD source code contained #ifdef's inside expressions, which is quite a difference compared to "or" and "and" in "static if". -- /Jacob Carlborg |
October 30, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, 29 October 2015 at 23:10:38 UTC, Walter Bright wrote: > On 10/29/2015 3:23 PM, rsw0x wrote: >> On Thursday, 29 October 2015 at 22:18:11 UTC, Walter Bright wrote: >>> https://www.cqse.eu/en/blog/living-in-the-ifdef-hell/ >>> >>> Another voice on what is wrong with the snarl of #ifdef's. >> >> how does this differ from static if and version(x) hell? > > We advise people not to use static if to do what version(x) eschews, and suggest better alternatives. The same thing can be said about #ifdef. Conventional wisdom in C++ says there's better ways, but the abuse compiles thus continually abused. |
November 02, 2015 Re: #ifdef hell | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 31/10/2015 12:01 AM, Jacob Carlborg wrote: > On 2015-10-30 03:01, Walter Bright wrote: > >> I might add that over time, I'd been removing #if's and #ifdef's from >> the dmd front end source code. The results were very satisfactory - the >> code was easier to read, understand and maintain. It also made running >> magicport on the code practical. > > The DMD source code contained #ifdef's inside expressions, which is > quite a difference compared to "or" and "and" in "static if". > Yes, this was the major problem with converting the #ifdefs, not conditions ||ed together. If D allowed oring versions together then version would have been a lot more useful in DDMD. |
Copyright © 1999-2021 by the D Language Foundation