memset vs bzero

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    #1

    memset vs bzero

    I have seen these two functions used interchangeably and could never
    fully discern their meaning, nor could understand the particular
    preference to either one.

    Could someone be kind enough to explain that (or least to direct me to
    a good source)?


    thanks

  • Krishanu Debnath

    #2
    Re: memset vs bzero

    puzzlecracker wrote:
    [color=blue]
    >I have seen these two functions used interchangeably and could never
    >fully discern their meaning, nor could understand the particular
    >preference to either one.
    >
    > Could someone be kind enough to explain that (or least to direct me to
    >a good source)?
    >
    >
    >thanks
    >
    >
    >[/color]
    bzero can only be used to reset memory location. Besides that bzero is
    not a standard function.

    Krishanu

    Comment

    • CBFalconer

      #3
      Re: memset vs bzero

      puzzlecracker wrote:[color=blue]
      >
      > I have seen these two functions used interchangeably and could
      > never fully discern their meaning, nor could understand the
      > particular preference to either one.
      >
      > Could someone be kind enough to explain that (or least to direct
      > me to a good source)?[/color]

      The function bzero() does not exist in standard C. To use it you
      have to define it first. Memset, on the other hand, pre-exists and
      has a known meaning.

      --
      Some informative links:
      news:news.annou nce.newusers
      Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!






      Comment

      • Villy Kruse

        #4
        Re: memset vs bzero

        On 22 Feb 2005 21:41:17 -0800,
        puzzlecracker <ironsel2000@gm ail.com> wrote:

        [color=blue]
        > I have seen these two functions used interchangeably and could never
        > fully discern their meaning, nor could understand the particular
        > preference to either one.
        >[/color]

        bzero was found on BSD unix, meset on AT&T unix. memset was
        adopted by the ANSI C and POSIX standards and bzero deprecated.


        Villy

        Comment

        • Mark McIntyre

          #5
          Re: memset vs bzero

          On 22 Feb 2005 21:41:17 -0800, in comp.lang.c , "puzzlecrac ker"
          <ironsel2000@gm ail.com> wrote:


          (a statement without qa subject)

          please put your question entirely in the mesage body. Not all newsreaders
          display the 'subject' line right next to the body, and you should not
          expect your readers to have to bob about to discover what you're talking
          about.

          By the way, bzero is nonstandard, and you should use memset.

          --
          Mark McIntyre
          CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
          CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

          ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
          http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
          ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

          Comment

          • James McIninch

            #6
            Re: memset vs bzero

            <posted & mailed>

            C has memset(), the Berkeley UNIX C library has bzero(). They are not
            identical, and bzero() predates memset() but is not widely available (since
            it's not part of standard C).

            puzzlecracker wrote:
            [color=blue]
            > I have seen these two functions used interchangeably and could never
            > fully discern their meaning, nor could understand the particular
            > preference to either one.
            >
            > Could someone be kind enough to explain that (or least to direct me to
            > a good source)?
            >
            >
            > thanks[/color]

            --
            Remove '.nospam' from e-mail address to reply by e-mail

            Comment

            • Randy Howard

              #7
              Re: memset vs bzero

              In article <04GdnYbvKKskB4 HfRVn-qQ@comcast.com> ,
              james.mcininch. nospam@comcast. net says...[color=blue]
              > bzero() predates memset() but is not widely available (since
              > it's not part of standard C).[/color]

              Well, it's supported on every Linux platform on the planet, if that
              helps. :-)

              --
              Randy Howard (2reply remove FOOBAR)
              "Making it hard to do stupid things often makes it hard
              to do smart ones too." -- Andrew Koenig

              Comment

              • Mark McIntyre

                #8
                Re: memset vs bzero

                On Wed, 23 Feb 2005 20:01:41 GMT, in comp.lang.c , Randy Howard
                <randyhoward@FO OverizonBAR.net > wrote:
                [color=blue]
                >In article <04GdnYbvKKskB4 HfRVn-qQ@comcast.com> ,
                >james.mcininch .nospam@comcast .net says...[color=green]
                >> bzero() predates memset() but is not widely available (since
                >> it's not part of standard C).[/color]
                >
                >Well, it's supported on every Linux platform on the planet, if that
                >helps. :-)[/color]

                which still doesn't count as widely available, for what its worth.

                --
                Mark McIntyre
                CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
                CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

                ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
                http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
                ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

                Comment

                • Christian Bau

                  #9
                  Re: memset vs bzero

                  In article <MPG.1c869d1b4f 5da6eb98a089@ne ws.verizon.net> ,
                  Randy Howard <randyhoward@FO OverizonBAR.net > wrote:
                  [color=blue]
                  > In article <04GdnYbvKKskB4 HfRVn-qQ@comcast.com> ,
                  > james.mcininch. nospam@comcast. net says...[color=green]
                  > > bzero() predates memset() but is not widely available (since
                  > > it's not part of standard C).[/color]
                  >
                  > Well, it's supported on every Linux platform on the planet, if that
                  > helps. :-)[/color]

                  So it is quite useful for people who want to write Linux-only,
                  non-portable code instead of writing portable code.

                  Comment

                  Working...