#Lattice #pragma
3 messages in this thread
I would just like to make one comment about the #pragma and Lattice's use
of it. This may not be what you are arguing about, but I would like to
clear it up for my sake and for other readers of this thread who may get
the wrong impression.
The Lattice #pragma is used to interface to resident libraries and does not
affect portability of code, since any code that would have a use for it is
already inherently unportable. Lattice, of course, does not use #pragma to
support inline assembly. Now back to the argument currently in progress.
🙂
Yes, I understand that about #pragma. The only thing that's a little
dangerous is that since pragmas are implementation defined, there is no
guarantee that a pragma of the same name will not mean something completely
different on another compiler, be it for the same machine or not. Now it
isn't a big chance to take, unless by some fluke there happens to be name
similarities among different compilers, but the chance is there.
My feeling on it is that it should be used as sparingly as possible, and
that anyone using a pragma, should probably encase it in an 'ifdef'
specifying the compiler used.
The nice thing about #pragmas is that by definition they are implimentation
defined. Thus when doing a port, its _very_ obvious to the programmer that
the #pragmas aren't going to work on the new machine/comiler. Other
methods of doing funky things, like new keywords, aren't nearly as easy to
catch, and have the potential for causing real headaches.