CompuServe Thread

Forum unknown · Off the Cuff

#What goes where?

9 messages in this thread
#109390From: Nick Sullivan/TransactorFeb 16, 1988 1:10 AM
John, you seem to have been watching the ANSI stuff. Do you know if char is going to be legislated as "signed", "unsigned" or "your choice, the way it now"? If the last (which I understand is the case), do you know why? Nick
#109403From: Don Curtis/SYSOPFeb 16, 1988 1:51 AM
Nick, Looking in the Lattice 4.0 manual…it gives some of the changes between K&R and ANSI and it doesn't say anything about typing of 'char' values, and Lattice supports both signed and unsigned char's. I would suspect that ANSI would leave it alone simply because under certain processors (such as the Amiga) a 'natural' value for an int is 32bits so a short would be 16bits…that leaves char for 8 bit values and there are occasions where you'd want them signed or unsigned. I've got another reference manual at work that supposedly conforms to the present ANSI reccomendations. I'll look in it tommorow to see what it says. Don
#109440From: Nick Sullivan/TransactorFeb 16, 1988 12:10 PM
Don, I'm talking about the default char, where signed or unsigned are not specified, as in: char foo; … in Manx, char is signed by default; in some other compilers (perhaps including Lattice – not sure), it is unsigned. I don't understand why that would not be something ANSI would leave alone, but I did get the impression from somewhere that it was not going to be regulated. Nick
#109449From: Don Curtis/SYSOPFeb 16, 1988 2:32 PM
Nick, I'm at work now and quoting from the new reference: 'The type signed was added to the proposed ANSI standard to allow the type signed char to be specified. Previously, some compilers defaulted to signed characters and others defaulted to unsigned. The modifier signed helps standardize the use of type char.' The ANSI list of data types shows the following: char ASCII characters signed char -128 to 127 unsigned char 0 to 255 The text accompaning the list of data types states: 'Values of type char are, in theory, restricted to the defined ASCII characters. Values outside that range may be handled differently in different C implementations.' Taking those two together, I read that ANSI is encouraging the default of unsigned char, but that it still may vary from compiler to compiler. Don
#109451From: John DraperFeb 16, 1988 3:06 PM
Well, I hope John reads this one. It is ambiguous, and really doesn't standardize anything, and in fact is about what i would expect. It does "encourage" one, but that is far from standardization. I would think that what it does encourage is 'signed', as ASCII is defined up to 127 only. Regards, Larry.
#109451From: John DraperFeb 16, 1988 3:06 PM
Well, I hope John reads this one. It is ambiguous, and really doesn't standardize anything, and in fact is about what i would expect. It does "encourage" one, but that is far from standardization. I would think that what it does encourage is 'signed', as ASCII is defined up to 127 only. Regards, Larry.
#109449From: Don Curtis/SYSOPFeb 16, 1988 2:32 PM
Nick, I'm at work now and quoting from the new reference: 'The type signed was added to the proposed ANSI standard to allow the type signed char to be specified. Previously, some compilers defaulted to signed characters and others defaulted to unsigned. The modifier signed helps standardize the use of type char.' The ANSI list of data types shows the following: char ASCII characters signed char -128 to 127 unsigned char 0 to 255 The text accompaning the list of data types states: 'Values of type char are, in theory, restricted to the defined ASCII characters. Values outside that range may be handled differently in different C implementations.' Taking those two together, I read that ANSI is encouraging the default of unsigned char, but that it still may vary from compiler to compiler. Don
#109440From: Nick Sullivan/TransactorFeb 16, 1988 12:10 PM
Don, I'm talking about the default char, where signed or unsigned are not specified, as in: char foo; … in Manx, char is signed by default; in some other compilers (perhaps including Lattice – not sure), it is unsigned. I don't understand why that would not be something ANSI would leave alone, but I did get the impression from somewhere that it was not going to be regulated. Nick
#109403From: Don Curtis/SYSOPFeb 16, 1988 1:51 AM
Nick, Looking in the Lattice 4.0 manual…it gives some of the changes between K&R and ANSI and it doesn't say anything about typing of 'char' values, and Lattice supports both signed and unsigned char's. I would suspect that ANSI would leave it alone simply because under certain processors (such as the Amiga) a 'natural' value for an int is 32bits so a short would be 16bits…that leaves char for 8 bit values and there are occasions where you'd want them signed or unsigned. I've got another reference manual at work that supposedly conforms to the present ANSI reccomendations. I'll look in it tommorow to see what it says. Don