ASM extensions

Georg Wrede georg.wrede at nospam.org
Thu Jul 13 23:46:02 PDT 2006



James Dunne wrote:
> BCS wrote:
> 
>> James Dunne wrote:
>>
>>> Hasan Aljudy wrote:
>>
>>
>> [...]
>>
>>>>
>>>> You don't have to implement any of it, this could be a syntactic sugar.
>>>>
>>>> for example,
>>>> asm(intel)
>>>> {
>>>> ....
>>>> }
>>>>
>>>> would be a shortcut for
>>>> version(intel)
>>>> {
>>>> asm
>>>> {
>>>> .....
>>>> }
>>>> }
>>>
>>>
>>>
>>>
>>> Maybe you're missing the fact that DMD has to understand Intel-style 
>>> ASM syntax so that it may process it correctly for the real assembler...
>>>
>>
>> DMD already has to be able to parse the ASM enough to find the end of 
>> the block. Consider:
>>
>> version(intel)
>> {
>> asm
>> {
>> ......
>> }
>> }
>> version(arm)
>> {
>> asm
>> {
>> ......
>> }
>> }
>>
>> Regardless of the compiler, to correctly find the end of the version, 
>> it needs to find the end of the asm. The suggested addition would only 
>> requirer DMD to be able to ignore contents of the "wrong" asm block, 
>> e.i. correctly find the closing "}" (as it already needs to).
>>
>> That said I have not used asm in D so, this is all of no use to me.
> 
> 
> version blocks need to be syntactially valid code.  They're not like the 
> C preprocessor's #if..#endif blocks.
> 
> If one of these ASM syntaxes involves the use of curly braces, then 
> finding the true end curly brace of the asm {} block itself might be 
> difficult without understanding the ASM syntax itself.

Actually it wouldn't, because the curly braces in _any_ syntax come in 
pairs. ;-)

But that fact alone doesn't help the real issue.



More information about the Digitalmars-d mailing list