Re: regarding memset

Discussion in 'C Programming' started by Donkey Hot, Jun 23, 2006.

  1. Donkey Hot

    Donkey Hot Guest

    Eric Sosman <> wrote in news:1150903810.313531@news1nwk:

    > Your memset() call fills "the whole array" apAppSpecInfo
    > with zero bytes. That array contains "the pointers" you
    > mention; all the pointers (and only the pointers) are cleared
    > with zero bytes. (On many machines this makes all the pointers
    > have the value NULL, but the C language does not actually
    > promise that all-bits-zero and NULL are equivalent.) Nothing
    > happens to whatever the pointers formerly pointed at, if they
    > pointed at anything.



    The size argument for this memset call is way too large, so the program
    will most propably crash.


    --
    Few things are harder to put up with than the annoyance of a good example.
    -- "Mark Twain, Pudd'nhead Wilson's Calendar"
     
    Donkey Hot, Jun 23, 2006
    #1
    1. Advertising

  2. Donkey Hot

    Eric Sosman Guest

    Donkey Hot wrote On 06/23/06 11:58,:
    > Eric Sosman <> wrote in news:1150903810.313531@news1nwk:
    >
    >
    >> Your memset() call fills "the whole array" apAppSpecInfo
    >>with zero bytes. That array contains "the pointers" you
    >>mention; all the pointers (and only the pointers) are cleared
    >>with zero bytes. (On many machines this makes all the pointers
    >>have the value NULL, but the C language does not actually
    >>promise that all-bits-zero and NULL are equivalent.) Nothing
    >>happens to whatever the pointers formerly pointed at, if they
    >>pointed at anything.

    >
    >
    >
    > The size argument for this memset call is way too large, so the program
    > will most propably crash.


    Which is the "this memset call" you are referring to?
    Oh: Is it the one you snipped away while leaving a bunch
    of irrelevant garbage? Smooth move ...

    For those who may have tuned in late, "this memset
    call" was

    > tRtInfo *apAppSpecInfo[MAX_ENTRIES];
    >
    > memset (apAppSpecInfo, 0, MAX_ENTRIES * (sizeof (tRtInfo *)));


    .... and although the size argument could be written better,
    I'm at a loss to understand why Donkey brays that it's
    "way too large."

    --
     
    Eric Sosman, Jun 23, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. k-man
    Replies:
    4
    Views:
    4,531
    Shelley Hebert
    Dec 18, 2003
  2. Joe C
    Replies:
    5
    Views:
    8,868
    tom_usenet
    Aug 24, 2004
  3. Replies:
    17
    Views:
    6,510
    Greg Comeau
    Sep 22, 2004
  4. Guest
    Replies:
    0
    Views:
    397
    Guest
    Sep 23, 2004
  5. Guest
    Replies:
    1
    Views:
    430
    Ron Natalie
    Sep 23, 2004
Loading...

Share This Page