Re: far pointers
"Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.60-041.04081209355 90.1583@unix48. andrew.cmu.edu> ...[color=blue]
> On Thu, 12 Aug 2004, CBFalconer wrote:[color=green]
> >
> > Jens.Toerring@p hysik.fu-berlin.de wrote:[color=darkred]
> >> Needing an array of ints (or long ints) with all elements
> >> initialized to 0 is more or less the only time I use calloc().[/color]
> >
> > While that may work for you, it is not guaranteed by the standard.[/color]
>
> Amplification (sorry!;) : memsetting an 'int' to zero is not
> guaranteed by the Standard to set the actual /value/ of that 'int'
> to the integer zero. (But I think there's some debate about that;
> I forget the details.) So what Jens is suggesting doesn't work.
>
> However, unsigned types are guaranteed to have pure binary
> representations , which means that memsetting an 'unsigned int' to
> zero /will/ set its value to the unsigned integer zero! Ditto
> 'unsigned char', 'unsigned long', et cetera. (And I think ditto
> the new C99 fixed-width types: 'int32_t' and 'int_least8_t' and
> friends.)
>
> I often use 'calloc' in image processing; for example, to get
> a grayscale image of size w*h initialized to black, I'll write
>
> unsigned char *im = calloc(w*h, 1);
>
> So 'calloc' does have its uses; they're just rare.
>
> -Arthur[/color]
I had gone through three books (just basics ones) but didnt find
memset memmove ect can any one plz explain it .
"Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.60-041.04081209355 90.1583@unix48. andrew.cmu.edu> ...[color=blue]
> On Thu, 12 Aug 2004, CBFalconer wrote:[color=green]
> >
> > Jens.Toerring@p hysik.fu-berlin.de wrote:[color=darkred]
> >> Needing an array of ints (or long ints) with all elements
> >> initialized to 0 is more or less the only time I use calloc().[/color]
> >
> > While that may work for you, it is not guaranteed by the standard.[/color]
>
> Amplification (sorry!;) : memsetting an 'int' to zero is not
> guaranteed by the Standard to set the actual /value/ of that 'int'
> to the integer zero. (But I think there's some debate about that;
> I forget the details.) So what Jens is suggesting doesn't work.
>
> However, unsigned types are guaranteed to have pure binary
> representations , which means that memsetting an 'unsigned int' to
> zero /will/ set its value to the unsigned integer zero! Ditto
> 'unsigned char', 'unsigned long', et cetera. (And I think ditto
> the new C99 fixed-width types: 'int32_t' and 'int_least8_t' and
> friends.)
>
> I often use 'calloc' in image processing; for example, to get
> a grayscale image of size w*h initialized to black, I'll write
>
> unsigned char *im = calloc(w*h, 1);
>
> So 'calloc' does have its uses; they're just rare.
>
> -Arthur[/color]
I had gone through three books (just basics ones) but didnt find
memset memmove ect can any one plz explain it .
Comment