Conditional compilation inside asm and enum declarations

grauzone none at example.net
Wed Jul 15 01:32:23 PDT 2009


Walter Bright wrote:
> Bill Baxter wrote:
>> On Tue, Jul 14, 2009 at 5:13 PM, Walter
>> Bright<newshound1 at digitalmars.com> wrote:
>>> Why do C and C++ (and D) make it difficult to do:
>>>
>>>   char *p;
>>>   p |= 1;
>>>
>>> ? There's no implementation difficulty in accepting such and generating
>>> correct code for it. It's purely a matter of making what is generally
>>> considered to be bad practice harder to do. I've never heard anyone 
>>> argue
>>> that this was a bad decision.
>>
>> I've never ever needed to do that, or been the slightest bit tempted
>> to.  The operation doesn't make sense.  So I think the analogy is
>> inappropos.

Often I wanted to write p &= ~3 in low level code. And that does make 
sense, because it aligns the pointer.

> The #ifndef NO_DEBUGGING is awful. The #ifndef __GNUC__ means compile 
> for every unknown compiler ever, except gcc. Can't possibly be right.

The #ifndef NO_DEBUGGING causes the code to be compiled in debugging 
mode, if it isn't explicitly deactivated. This is a good thing. I think 
dmd should compile in debug mode too, and force the user to pass 
-nodebug to disable it.

The #ifndef _GNUC_ is probably for using gcc compiler/libc extensions, 
which makes sense.



More information about the Digitalmars-d mailing list