Bug 40020 - Add support for apr_uint8_t and apr_int8_t types
Summary: Add support for apr_uint8_t and apr_int8_t types
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: Other All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2006-07-11 20:28 UTC by Mike Duigou
Modified: 2007-07-09 10:37 UTC (History)
0 users



Attachments
adds support for uint8 and int8 types to apr.h (2.76 KB, patch)
2006-07-11 20:29 UTC, Mike Duigou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Duigou 2006-07-11 20:28:49 UTC
A patch to add apr_uint8_t and apr_int8_t to apr.h is attached. It also ensures
that CHAR_BIT is 8 bits (it normally is) and that short_value and long_value are
defined.
Comment 1 Mike Duigou 2006-07-11 20:29:54 UTC
Created attachment 18589 [details]
adds support for uint8 and int8 types to apr.h
Comment 2 William A. Rowe Jr. 2007-05-31 23:38:18 UTC
since this falls into 1.3.x - it falls into the enhancement category.
Comment 3 Joe Orton 2007-07-04 03:06:58 UTC
Why not use "unsigned char" and "signed char"? 
Comment 4 Mike Duigou 2007-07-09 10:37:53 UTC
For the same reason that uint32 and int32 is used rather than unsigned int or
signed int--the size of "char" is not fixed. 

Admittedly char is almost always 8 bits except for some obscure embedded OSes
that are used Asia (native 16 bit chars) and are not likely targets for APR.

Using only the uint* and int* types for wire protocols has a nice symmetry and
specificness as well. ie.

struct foo {
  int8  version;
  uint8 type;
  int16 thing;
  uint16 length;
  int32 signature;
  uint32 control;
  int64 offset;
  uint64 time;
};