- **C Programming**
(*http://www.velocityreviews.com/forums/f42-c-programming.html*)

- - **An implementation where sizeof(short int) does not divide sizeof(int)**
(*http://www.velocityreviews.com/forums/t445908-an-implementation-where-sizeof-short-int-does-not-divide-sizeof-int.html*)

An implementation where sizeof(short int) does not divide sizeof(int)Do you have an example of an implementation where
sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long int) ? Same question for the corresponding unsigned types. |

Re: An implementation where sizeof(short int) does not divide sizeof(int)Spiros Bousbouras wrote:
> Do you have an example of an implementation where > sizeof(short int) does not divide sizeof(int) or > sizeof(int) does not divide sizeof(long int) or > sizeof(long int) does not divide sizeof(long long int) ? > > Same question for the corresponding unsigned types. What about... An implementation where long has 40 value bits... (TI DSPs) An implementation where sizeof (long double) == 10 or == 12... (IEEE 754 Standard) |

Re: An implementation where sizeof(short int) does not divide sizeof(int)"Spiros Bousbouras" <spibou@gmail.com> wrote in message
news:1168895695.086968.65300@v45g2000cwv.googlegro ups.com... > Do you have an example of an implementation where > sizeof(short int) does not divide sizeof(int) or > sizeof(int) does not divide sizeof(long int) or > sizeof(long int) does not divide sizeof(long long int) ? > > Same question for the corresponding unsigned types. Interesting question, but probably irrelevant to actual programming. It is an accident of computer evolution that the relationships you are seeking an exception to exist. I have no idea why in the world one can't easily find a computer with 40-bit integers or 48-bit integers, for example. Counteroffer: can you show me a poor 'C' implementation that will fail if the relationships you mention don't hold? I've never seen that, either. -- David T. Ashley (dta@e3ft.com) http://www.e3ft.com (Consulting Home Page) http://www.dtashley.com (Personal Home Page) http://gpl.e3ft.com (GPL Publications and Projects) |

Re: An implementation where sizeof(short int) does not divide sizeof(int)Spiros Bousbouras wrote:
> Do you have an example of an implementation where > sizeof(short int) does not divide sizeof(int) or > sizeof(int) does not divide sizeof(long int) or > sizeof(long int) does not divide sizeof(long long int) ? No, but I have used two where sizeof(int) does not divide sizeof(double) [4 and 10 respectively.] > Same question for the corresponding unsigned types. Yes, it is the same question. The size of a signed integer is necessarily the same as the size of the corresponding unsigned type. But why are you concerned about size? It's a common misconception that size is more important than value. [Read that any way you want.] Another popular misconception is that _where_ an object is located is more important than _when_ it exists. -- Peter |

Re: An implementation where sizeof(short int) does not divide sizeof(int)Spiros Bousbouras wrote: > Do you have an example of an implementation where > sizeof(short int) does not divide sizeof(int) or > sizeof(int) does not divide sizeof(long int) or > sizeof(long int) does not divide sizeof(long long int) ? > > Same question for the corresponding unsigned types. How about where sizeof int is not evenly divisible by sizeof char? CDC Cyber UTexas C compiler 60 bits is not divisible by 8. They stored characters two words at a time though, so you had 120 bits, which is divisible by 8. IIRC. |

Re: An implementation where sizeof(short int) does not divide sizeof(int)"user923005" <dcorbit@connx.com> writes:
> Spiros Bousbouras wrote: >> Do you have an example of an implementation where >> sizeof(short int) does not divide sizeof(int) or >> sizeof(int) does not divide sizeof(long int) or >> sizeof(long int) does not divide sizeof(long long int) ? >> >> Same question for the corresponding unsigned types. > > How about where sizeof int is not evenly divisible by sizeof char? > CDC Cyber UTexas C compiler I don't think non-ANSI implementations are on-topic here. -- Ben Pfaff email: blp@cs.stanford.edu web: http://benpfaff.org |

Re: An implementation where sizeof(short int) does not divide sizeof(int)In article <UMidnTAQ4YqNizHYnZ2dnUVZ_vyunZ2d@giganews.com> "David T. Ashley" <dta@e3ft.com> writes:
> "Spiros Bousbouras" <spibou@gmail.com> wrote in message > news:1168895695.086968.65300@v45g2000cwv.googlegro ups.com... > > Do you have an example of an implementation where > > sizeof(short int) does not divide sizeof(int) or > > sizeof(int) does not divide sizeof(long int) or > > sizeof(long int) does not divide sizeof(long long int) ? > > > > Same question for the corresponding unsigned types. > > Interesting question, but probably irrelevant to actual programming. Indeed, not very interesting. But something like that happened on the Cray-1. I disremember whether a short was 24 or 32 bits. But there was a compiler flag that said that ints were either 48 or 64 bits, but the size of a short was fixed. I think the base mode was shorts of 24 bits and ints of 48 bits and the extravaganza mode was shorts of 24 bits and ints of 64 bits. -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131 home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/ |

Re: An implementation where sizeof(short int) does not divide sizeof(int)In article <1168909869.077912.146100@38g2000cwa.googlegroups. com>,
"user923005" <dcorbit@connx.com> wrote: > > How about where sizeof int is not evenly divisible by sizeof char? > CDC Cyber UTexas C compiler sizeof char is 1. How is anything not evenly divisible by one? -- Posted via a free Usenet account from http://www.teranews.com |

Re: An implementation where sizeof(short int) does not divide sizeof(int)user923005 wrote:
> How about where sizeof int is not evenly divisible by sizeof char? sizeof(char) is always 1, so this is not possible. > CDC Cyber UTexas C compiler > > 60 bits is not divisible by 8. They stored characters two words at a > time though, so you had 120 bits, which is divisible by 8. "sizeof" gives the size in bytes, not in bits. |

Re: An implementation where sizeof(short int) does not divide sizeof(int)In article <1168909869.077912.146100@38g2000cwa.googlegroups. com> "user923005" <dcorbit@connx.com> writes:
> Spiros Bousbouras wrote: > > Do you have an example of an implementation where > > sizeof(short int) does not divide sizeof(int) or > > sizeof(int) does not divide sizeof(long int) or > > sizeof(long int) does not divide sizeof(long long int) ? > > > > Same question for the corresponding unsigned types. > > How about where sizeof int is not evenly divisible by sizeof char? > CDC Cyber UTexas C compiler That would violate the standard. sizeof is expressed as an integral unit, where sizeof char == 1. And that was already true in K&R. > 60 bits is not divisible by 8. They stored characters two words at a > time though, so you had 120 bits, which is divisible by 8. That is possible (but gives problems with floats that are also 60 bits). But on those machines it is much more reasonable to have 48 bit ints with the remaining 16 bits (possible) garbage. But integer arithmetic on those machines had quite a few strange points. That is, I could easily construct examples where: (a + a) * 2 != a + a + a + a in integer arithmetic, even when a < 2**48. -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131 home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/ |

All times are GMT. The time now is 01:04 AM. |

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.

SEO by vBSEO ©2010, Crawlability, Inc.