#: 11444 S3/Languages
22-Jul-91 22:24:29
Sb: #C Compiler Problem
Fm: Jay Truesdale 72176,3565
To: all
I'm using a coco 3 with OS9 level 2. Consider the following C code fragment:
struct _mtable {
char _mnem[8];
int _mvi;
char _mvc; };
struct _mtable mtable[3] = {
"!dummy", 0, 1,
"abcd", 1, 2,
"add", 18, 10,
};
This will even compile. Now consider the following assembler code generated by
the C Compiler:
* *struct _mtable mtable[3] = {
vsect mtable: * * "!dummy", 0, 1,
fdb _1
fcb 0
fcb 1 * * "abcd", 1, 2,
fdb _2
fcb 1
fcb 2
.....etc.
On page 1-5 of my Tandy C manual is states that a data type of INT is two bytes
in size. My question is why the field corresponding to the INT type in the
above assembler code is generated in assembler by an FCB which means "fill
constant BYTE" which is one byte not two! The problem comes up later when the
values exceed 255, the assembler rightly complains. I'm baffled, anyone got a
clue here???
Thanks, -J
There are 3 Replies.
|