#Lattice & Aztec code dif
04-Dec-90 23:43:54
Sb: #4726-#Lattice & Aztec code dif
Fm: Bob Rakosky 75156,336
To: John Lemoine 75320,143
John,
Most code that I've seen that was written for Manx compiles OK with
SAS/Lattice. The big thing that you have to watch out for is the
statement:
#include <functions.h>
which is a Manx include file that doesn't exist on the Lattice system. The
(almost) equivalent SAS #include file is <proto/all.h>. The other
difference that I've seen when converting to SAS (or Lattice, which is the
same only an older version) is that many programs generate a lot of
compiler warning messages (but not necessarily errors). The SAS compiler
is a lot fussier than Manx (particularly the older Manx compiler), and
consequently gives warnings on the same code that Manx didn't complain
about at all. Both compilers are "right" – the code _usually_ works,
although there is something that's not quite right – for example, the
following code would generate this type of warning with SAS:
struct IntuiMessage *msg;
if (msg = GetMsg(mywindow->UserPort))
{
ReplyMsg(msg);
}
Now, this code works correctly (except it doesn't do much <grin>, but the
compiler will complain because the GetMsg() function returns a pointer to a
Message structure, not an IntuiMessage structure, and the ReplyMsg()
function needs a pointer to a Message structure as a passed argument. Now,
the IntuiMessage structure is really the same as a Message structure,
except that it has more data tacked on to the end of it, so the above code
is not really incorrect (which is why Manx doesn't complain), but SAS is
correct also in that you are not referencing the "correct" variable types.
You can get around this with the use of C casts, which temporarily override
the "type" of variable being referenced. As such:
struct IntuiMessage *msg;
if (msg = (struct IntuiMessage *) GetMsg(mywindow->UserPort)
{
ReplyMsg((struct Message *)msg);
}
Hope this helps…
…BobR