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. Advertisements

  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. Advertisements

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,727
    Shelley Hebert
    Dec 18, 2003
  2. Joe C
    Replies:
    5
    Views:
    9,466
    tom_usenet
    Aug 24, 2004
  3. Replies:
    17
    Views:
    7,272
    Greg Comeau
    Sep 22, 2004
  4. Guest
    Replies:
    1
    Views:
    545
    Ron Natalie
    Sep 23, 2004
  5. =?ISO-8859-1?Q?Sacha_Sch=E4r?=

    Using memset instead of a proper ctor

    =?ISO-8859-1?Q?Sacha_Sch=E4r?=, Jan 24, 2005, in forum: C++
    Replies:
    12
    Views:
    656
    Dietmar Kuehl
    Jan 24, 2005
  6. copx

    memset() and portability

    copx, Jul 24, 2003, in forum: C Programming
    Replies:
    10
    Views:
    766
    Eric Sosman
    Jul 28, 2003
  7. Mantorok Redgormor

    perils of memset

    Mantorok Redgormor, Feb 22, 2004, in forum: C Programming
    Replies:
    2
    Views:
    1,173
    Christian Bau
    Feb 22, 2004
  8. Zhiqiang Ye
    Replies:
    53
    Views:
    11,251
    Dan Pop
    Jun 28, 2004
Loading...