Re: bytes calculation



On Mon, 30 Jul 2007 08:35:08 -0700, Nick Keighley wrote:

On 30 Jul, 15:55, jacob navia <ja...@xxxxxxxxxxxxxxxx> wrote:
Spoon wrote:
Pietro Cerutti wrote:

Assuming that sizeof(unsigned long long) == 64 and sizeof(int) == 32

I think you meant "Assuming CHAR_BIT == 8, sizeof(int) == 4, and
sizeof(unsigned long long) == 8".

Please, are you a lawyer?

you say that like it's a bad thing...

Note: sizeof returns the number of chars in an object (or type)
*not* the number of bits.


Can you tell me of a machine where char_bit != 8 ?

And please, a machine in use 2007 ok?

But like you I'm puzzled as to why a 32-bit shift
on a 64-bit quantity doesn't yield the top 32-bits.
Unless I misunderstood something...

unsigned long long scnlen;
int scnlen_hi;
sclen_hi = scnlen >> 32;

If the upper half of scnlen contains a value within the range of the upper
32 bits of an unsigned long long, but outside the range of a 32-bit signed
int, bad things could happen, no?
.



Relevant Pages

  • Re: bytes calculation
    ... Please, are you a lawyer? ... sizeof returns the number of chars in an object ... If the upper half of scnlen contains a value within the range of the upper ... int, bad things could happen, no? ...
    (comp.lang.c)
  • Re: bytes calculation
    ... Please, are you a lawyer? ... sizeof returns the number of chars in an object ... If the upper half of scnlen contains a value within the range of the upper ... int, bad things could happen, no? ...
    (comp.lang.c)
  • Re: question
    ... bytes are there in an int in this implementation? ... I checked with sizeof. ... Chars are 8 bit and ints are 32 bit in this OS. ... actually have a 64 bit address bus but the OS I'm using, linux is a 32 bit ...
    (comp.lang.c)
  • SSPI Kerberos for delegation
    ... security context created in server to connect back and authenticate to ... DWORD bufsiz = sizeof buf; ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (microsoft.public.win32.programmer.kernel)
  • SSPI delegation using kerberos
    ... security context created in server to connect back and authenticate to ... DWORD bufsiz = sizeof buf; ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (microsoft.public.platformsdk.security)