Re: Request assistance converting C's #ifndef to D

2016-05-16 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/14/16 12:35 AM, Steven Schveighoffer wrote: On 5/13/16 12:59 AM, Andrew Edwards wrote: On 5/13/16 8:40 AM, Andrew Edwards wrote: That seems wrong. You can't assign to an enum. Besides, doesn't your declaration of MIN shadow whatever other definitions may be currently in effect? Okay,

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread sanjayss via Digitalmars-d-learn
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Kagamin via Digitalmars-d-learn
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/16 12:59 AM, Andrew Edwards wrote: On 5/13/16 8:40 AM, Andrew Edwards wrote: That seems wrong. You can't assign to an enum. Besides, doesn't your declaration of MIN shadow whatever other definitions may be currently in effect? Okay, got it. It seams I just hadn't hit that bug yet

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 3:23 PM, tsbockman wrote: On Friday, 13 May 2016 at 06:05:14 UTC, Andrew Edwards wrote: Additionally, what's the best way to handle nested #ifdef's? Those that appear inside structs, functions and the like... I know that global #ifdef's are turned to version blocks but versions

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread tsbockman via Digitalmars-d-learn
On Friday, 13 May 2016 at 06:05:14 UTC, Andrew Edwards wrote: Additionally, what's the best way to handle nested #ifdef's? Those that appear inside structs, functions and the like... I know that global #ifdef's are turned to version blocks but versions blocks cannot be used inside classes,

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 7:51 AM, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif #ifndef MAX #define MAX

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread tsbockman via Digitalmars-d-learn
On Friday, 13 May 2016 at 04:59:23 UTC, Andrew Edwards wrote: Is there a way to reproduce the same behavior? Are there reason's for not allowing this functionality or am I just misunderstanding and going about things the wrong way? [1] same result whether placed before or after the

Re: Request assistance converting C's #ifndef to D

2016-05-12 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 8:40 AM, Andrew Edwards wrote: That seems wrong. You can't assign to an enum. Besides, doesn't your declaration of MIN shadow whatever other definitions may be currently in effect? Okay, got it. It seams I just hadn't hit that bug yet because of other unresolved issues. Perhaps

Re: Request assistance converting C's #ifndef to D

2016-05-12 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 8:00 AM, H. S. Teoh via Digitalmars-d-learn wrote: On Fri, May 13, 2016 at 07:51:17AM +0900, Andrew Edwards via Digitalmars-d-learn wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has

Re: Request assistance converting C's #ifndef to D

2016-05-12 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, May 13, 2016 at 07:51:17AM +0900, Andrew Edwards via Digitalmars-d-learn wrote: > The following preprocessor directives are frequently encountered in C > code, providing a default constant value where the user of the code > has not specified one: > > #ifndef MIN > #define MIN

Request assistance converting C's #ifndef to D

2016-05-12 Thread Andrew Edwards via Digitalmars-d-learn
The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif #ifndef MAX #define MAX 999 #endif I'm at