TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: all
from: Jay Truesdale 72176,3565
date: 1991-08-20 21:52:17
subject: #Fixin` C Compiler Bug

#: 11863 S3/Languages
    20-Aug-91  21:52:17
Sb: #Fixin' C Compiler Bug
Fm: Jay Truesdale 72176,3565
To: all

Well, here we go again!  Consider the following C code with
the character initialization changed by Bruce Makenzie's 
program.  I added the terminating null character to each 
string  myself.
 
struct _mtable {
    char _mnem[8]; 
    int  _mvi;      
    char _mvc;     
};
 
static struct _mtable mtable[3] = 
{
    {'!','d','u','m','m','y',0}, 1,      2,
    {'a','b','c','d',0},         3,      4,
    {'a','d','d',0},             5,      6
};
 
This looks fine to me but the C Compiler says:
 
test4.c : line 10  ****  } expected  ****
 {'a','b','c','d',0}, 3, 4,
     ^
test4.c : line 10  ****  ; expected  ****
 {'a','b','c','d',0}, 3, 4,
                      ^
test4.c : line 11  ****  too many brackets  ****
 {'a','d','d',0}, 5, 6
               ^
test4.c : line 11  ****  identifier missing  ****
 {'a','d','d',0}, 5, 6
                ^
test4.c : line 11  ****  identifier missing  ****
 {'a','d','d',0}, 5, 6
                  ^
test4.c : line 11  ****  ; expected  ****
 {'a','d','d',0}, 5, 6
                  ^
 
The C code looks OK to me according to my main reference, 
I'm going to dig out my other C books and have a look.
 
It kinda looks to me like only the first chatacter is being
assigned to the string variable. (?)
 
In the meantime can anyone see what's going on here? 
This has to be a simple syntax problem.  (I hope)
 
Thanks, -J
 

There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.