[M3devel] "target specific pragmas"?

Darko darko at darko.org
Tue Feb 12 02:37:49 CET 2008


I think it's not a good idea. I think all platform specific code  
should be in a separate file. I'd also like to see an option to move  
calling conventions to the makefile rather than in pramas to avoid  
having to duplicate interface files just to have a different calling  
convention for a different platform.

- Darko


On 12/02/2008, at 12:21 PM, Jay wrote:

> So I have NOT thought this through.
>
> I wonder if "preprocessing" dependent only on "target" is a good idea.
>
> Something like either the ability to prefix pragmas with a target,  
> or an "iftarget" and "ifnottarget" pragma.
>
> Something like so:
>
> <* IF_TARGET NT386 *>
> <* END_IF_TARGET*>
>
>
> <* IF_TARGET NT386 *>
> <* END_IF_TARGET*>
> It's a small can of worms.
> Where can they be placed? Only at "global" scope? (ie: toplevel in  
> an interface/module).
>
> What about IF_OSTYPE?
> What about expressions?
> IF_TARGET NT386 OR NTAMD64
>
> IF_TARGET STARTS(NT)
>
> etc.
>
> I don't really have enough interest here to work through this, just  
> sending out the bait...
>
> Obviously this was triggered by my happening into the odbc directory  
> and bringing up ignoring WINAPI on non-NT386 or prefixing calling  
> conventions with a target.
>
> This reminds me of an important point here however -- nobody else is  
> going to make the mistake of ever having multiple calling  
> conventions. Therefore the generality of prefixing WINAPI with  
> NT386: is useless.
> Unless Mac68K support is added.
>
> And here is some rationale even. The PC and Mac evolved from "small"  
> systems, where assembly programming was common, more people knew  
> more lower level details and playing games with calling conventions  
> was something anyone could do. Most other current systems are rooted  
> in C programming. Working in C, calling conventions are generally in  
> a hidden layer below what anyone thinks about. Therefore, the  
> smaller number of capable people working at that level have the good  
> sense to only have one calling convention. No more systems will  
> evolve from "small", at least not without having observed this  
> history. Therefore, there will no longer be multiple calling  
> conventions.
>
> That is my theory at least.
>
> Oh, Windows does also have __thiscall and __clrcall. __thiscall is  
> only x86




More information about the M3devel mailing list