X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Trace-PostClient-IP: 68.147.131.211 From: Brian Inglis Newsgroups: comp.os.msdos.djgpp Subject: Re: 16 bit integers Organization: Systematic Software Message-ID: References: <4045a682$1 AT news DOT infonet DOT ee> <8d4d405go3mm3kvb70drkoat31ukdep52o AT 4ax DOT com> <404705d5$1 AT news DOT infonet DOT ee> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 39 Date: Thu, 04 Mar 2004 21:26:19 GMT NNTP-Posting-Host: 24.71.223.147 X-Complaints-To: abuse AT shaw DOT ca X-Trace: pd7tw3no 1078435579 24.71.223.147 (Thu, 04 Mar 2004 14:26:19 MST) NNTP-Posting-Date: Thu, 04 Mar 2004 14:26:19 MST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 4 Mar 2004 12:32:51 +0200 in comp.os.msdos.djgpp, "Tõnu Aas" wrote: >> Portable assumptions are: char holds at least 8 bits, int at least 16, >> long at least 32: pick the appropriate size for the range of integers >> you have to deal with. Avoid C99 stdint.h if you want to be portable >> to most existing implementations. > >You can create your own stdint.h if "existing implementations" havent one. >Its much easier than using #ifdefs all over you code to maintain >portability. Are you trying to imply the types defined in stdint.h are more portable than char, int, long? If you use the stdint.h definitions, maybe you should include the header with your code to ensure portability. That saves others the trouble of making up their own, or editing your types back to the base t0ypes. Do you really see an advantage to using int_least16_t or int_fast32_t where int and long would do? Or do you just want to be first on the block who can claim they littered their code with extraneous types from stdint.h? AFAICT stdint.h is intended for use in circumstances where particular integer characteristics are required for particular reasons in portable code. By using the new integer types, you are raising flags saying these variables are special, and you may cause the compiler to generate extra code to ensure that standards requirements are met. OTOH I expect most compilers to just treat them the same as the base types, so in that case what have you gained in terms of code clarity, efficiency, and portability? -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian dot Inglis at SystematicSw dot ab dot ca) fake address use address above to reply