From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,9a2a420ec841e44c,start X-Google-Attributes: gidfee84,public From: bernhard@alpha1.csd.uwm.edu (Bernhard Reiter) Subject: Dec C pecularity Date: 1999/06/09 Message-ID: #1/1 X-Deja-AN: 487335141 Organization: University of Wisconsin - Milwaukee User-Agent: slrn/0.9.5.4 (UNIX) Newsgroups: comp.unix.osf.osf1 While compiling mutt-0.95.6i on OSF1 V4.0 878 alpha using DEC C V5.6-079 on Digital UNIX V4.0 (Rev. 878) I encountered a difference between gnu c and Dec c. Wheather this is a bug or not, I can't say, but at least it is a pitfall. Consider the following program, Dec C doesn't like the y definition: #include char x[]="\ Hi\n Here is more\n\ Wolw\n"; char y[]=("Hi there"); int main(void){ printf("%s",x); return 0; } alpha1 mutt-0.95.6 166: gcc -pedantic -ansi -Wall probe.c alpha1 mutt-0.95.6 167: cc probe.c cc: Warning: probe.c, line 7: In the initializer for y[0], "("Hi there")" has a larger data size than "signed char". Assignment may result in data loss. char y[]=("Hi there"); ---------^ cc: Warning: probe.c, line 7: In the initializer for y[0], "("Hi there")" of typ e "pointer to signed char", is being converted to "signed char". char y[]=("Hi there"); ---------^ cc: Error: probe.c, line 7: In the static initialization, the address cannot be converted to the destination type. char y[]=("Hi there"); ---------^ alpha1 mutt-0.95.6 168: cc -std1 probe.c cc: Error: probe.c, line 7: In the initializer for y a required set of braces is missing. char y[]=("Hi there"); ---------^ Cheers, Bernhard -- Research Assistant, Geog Dept UM-Milwaukee, USA. (www.uwm.edu/~bernhard) Funding/Promoting Association for a Free Informational Infrastructure (ffii.org)