19

Possible Duplicate:
Rephrased: list of platforms supported by the C standard

The C standard is very loosely defined: - it covers two's complement, ones' complement, signed magnitude - integers can be of various width, with padding bits - certain bit patterns may not represent valid values.

There is a obvious downside to this: it make portable code harder to write. Does anyone know of platforms for which there are still active development work, but which are

  • not 2's complement or
  • the integer width is not 32 bits or 64 bits or
  • some integer types have padding bits or
  • if you worked on a 2's complement machine, the bit pattern with sign bit 1 and all value bits zero is not a valid negative number or
  • integer conversion from signed to unsigned (and vice versa) is not via verbatim copying of bit patterns or
  • right shift of integer is not arithmetic shift or
  • the number of value bits in an unsigned type is not the number of value bits in the corresponding signed type + 1 or
  • conversion from a wider int type to a smaller type is not by truncation of the left most bits which would not fit
Community
  • 1
  • 1
tyty
  • 839
  • 5
  • 12
  • 12
    For AVR microcontrollers, avr-gcc uses 16-bit int's and pointers. – Ambroz Bizjak Nov 04 '11 at 10:01
  • 2
    I see this question being downvoted when I would prefer it to be edited to match this site's expectations, or programmers.stackexchange.com's. This said, from the point of view of the programmer, it is always possible to pick another language when one thinks C is too loosely defined (D, Ada, ...). From the point of view of the compiler maker, it is always possible to guarantee more than the strict minimum imposed by the standard (all the choices you list, or simply "compatible with GCC's choices as far as possible", ...) – Pascal Cuoq Nov 04 '11 at 10:04
  • @Ambroz Bizjak: Shouldn't this be an answer rather than a comment? I would upvote it. – undur_gongor Nov 04 '11 at 10:15
  • 4
    Why close? This *is* answerable factually. An answer would consist of one or more actively used C implementation which fits one or more of the criterions listed in the question. It's *not* asking "is it OK to write non-compliant code because it'll work everywhere". – Ambroz Bizjak Nov 04 '11 at 10:39
  • For those who are still interested, I have rephrased the question at http://stackoverflow.com/q/8007825/1016492 – tyty Nov 04 '11 at 11:37
  • 1
    @tyty: Questions in SO can be reopened (as just happened here). It is better to edit the existing question instead of creating a new version of it. – hugomg Nov 09 '11 at 13:24
  • TI's TMS320C54xx's char's are 16-bit. And long's must be aligned on even addresses, otherwise instead of 0x12345678 you can get x56781234. Not to mention that sizeof(char*) – Alexey Frunze Nov 09 '11 at 13:46
  • @missingno my apologies, how does one go about reopening the question after editing it? – tyty Nov 10 '11 at 04:27
  • @tyty: If enough people agree that the question should be reopened they can vote to [do so](http://meta.stackexchange.com/questions/36415/how-do-you-reopen-a-closed-question) (as happened here - chack the edit history). You can also try flagging the question for moderator attention if it doesn't work after a while. – hugomg Nov 10 '11 at 10:51

2 Answers2

2

yes...it is still used in embedded system and in micro-controllers. It is also used in education purposes.

Ashutosh Dave
  • 382
  • 16
  • 33
1

yes, we see this all the time when working with customizable microcontrolers and DSPs for things like audio processing.

tletnes
  • 1,958
  • 10
  • 30
  • can you elaborate on which features, e.g. padding bits that were found in these microcontrollers ? – tyty Nov 10 '11 at 04:26