Re: Promoting unsigned long int to long int



pereges wrote:

If I had to store 80-90 of structures and each had a member say
'axis'. How much of a difference would using a unsigned char over int
would make (for that member) ? For my program, space as well as
performance are important.

On my machine it would make
no difference in terms of usable memory saved
and it would slow down the arithmetic operations.

An array of char will save usable space over an array of int;
but if I only define several distinct char objects in a function,
my compiler will place them on int boundaries.
Meaning that in between the char objects,
there are three bytes of unusable memory
(sizof(int) equals 4 on my machine).

char arithmetic on my machine
is accomplished in int size objects or registers,
requiring additional masking operations.

--
pete
.



Relevant Pages

  • Re: socket communication: send & receive doesnt work right
    ... Maybe start from sending simple byte array to check what happen with byte ... I did a test of sending two doubles: ... public void send_doubles(double vals, int len) throws IOException ... char *result; ...
    (microsoft.public.win32.programmer.networks)
  • Re: Queue question wih dyn mem alloc
    ... I wrote two functions to pusha character array onto an array and ... int Len=0; ... int push(char **list, char *str, int curlen){ ... arrays to carry an array of strings. ...
    (comp.lang.c)
  • Re: Memory Allocation Problem, please help
    ... typedef struct word_tag{ ... array is not an array. ... static int total_word_count; ... static int word_index(const char *word); ...
    (comp.lang.c)
  • Re: Newbie: out of memory issues
    ... Heres the problem code:: Lots of array handling with objects.. ... You should use CString. ... char out2; ... BOOL swe_date_conversion(int year, int month, int day, int hour, int cal, double & ...
    (microsoft.public.vc.mfc)
  • Re: Queue question wih dyn mem alloc
    ... I wrote two functions to pusha character array onto an array and ... int Len=0; ... int push(char **list, char *str, int curlen){ ... arrays to carry an array of strings. ...
    (comp.lang.c)