random_shuffle seed

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

    #16
    Re: random_shuffle seed

    "Pete Becker" <petebecker@acm .org> wrote in message
    news:3FAA5FC8.8 2984BEB@acm.org ...[color=blue]
    > DrPizza wrote:[color=green]
    > >
    > > "Pete Becker" <petebecker@acm .org> wrote in message
    > > news:3FA9B097.7 46AD23B@acm.org ...[color=darkred]
    > > > DrPizza wrote:
    > > > >
    > > > > You wouldn't want to permit your C++ library to call strtok()
    > > > > internally, would you?
    > > >
    > > > Sure. Why not?[/color]
    > > Because it means you can't use strtok() yourself?[/color]
    > Non sequitur.[/color]
    If the implementation can call strtok() then I can't be sure what state
    strtok()'s static buffer is in -- it need not be in the state I left it in.
    This renders strtok() useless. If I use it I risk fucking up the library; if
    the library uses it it risks fucking up my program.
    [color=blue]
    > The C++ standard does not change that constraint. No C function calls
    > rand.[/color]
    Except the "not called by the library" statement refers only to the library of
    the implementation, not the C library. Given that in C++ the implementation
    is one of C++, and the library is that of C++, the restriction should constain
    the C++ library too.


    --
    Now Playing: Daft Punk - Around The World


    char a[99999],*p=a;main(c,V) char**V;{char*v =c>0?1[V]:V;if(c)for(;(c =*v)&&93^
    c;p+=!(62^c)-!(60^c),*p+=!(4 3^c)-!(45^c),44^c||r ead(0,p,1),46^c ||putchar(*p)
    ,91^c||(v=*p?ma in(-1,v+1),v-1:main(0,v)),++ v);else for(;c+=!(91^*v )-!(93^*v)
    ;++v);return v;} /* drpizza@battlea xe.net brainf*** program as argv[1] */


    Comment

    • Pete Becker

      #17
      Re: random_shuffle seed

      DrPizza wrote:[color=blue]
      >
      > "tom_usenet " <tom_usenet@hot mail.com> wrote in message
      > news:nckkqvsrn5 lghoe2ire026mqv qlvqsr332@4ax.c om...[color=green]
      > > The C standard only says that the implementation of the C library
      > > won't call them.[/color]
      > Well, no, it doesn't, it simply says that the implementation shall behave as
      > if no library function calls rand. It doesn't specify which library.
      >[color=green]
      > > Taking the original quote:
      > > "The implementation shall behave as if no library function calls the
      > > rand function"
      > >
      > > The "library" referred to is the C library, not the C++ one. Just
      > > because C++ includes the (slightly modified) C library doesn't mean
      > > that it *is* the C library.[/color]
      > Upon incorporation into C++, "the library" refers to the C++ library. The C++
      > library is the only library there is, so it's the only one it could refer to.
      >[/color]

      Where in the C++ standard do you find this assertion?

      --

      Pete Becker
      Dinkumware, Ltd. (http://www.dinkumware.com)

      Comment

      • Pete Becker

        #18
        Re: random_shuffle seed

        DrPizza wrote:[color=blue]
        >
        > "Pete Becker" <petebecker@acm .org> wrote in message
        > news:3FAA5FC8.8 2984BEB@acm.org ...[color=green]
        > > DrPizza wrote:[color=darkred]
        > > >
        > > > "Pete Becker" <petebecker@acm .org> wrote in message
        > > > news:3FA9B097.7 46AD23B@acm.org ...
        > > > > DrPizza wrote:
        > > > > >
        > > > > > You wouldn't want to permit your C++ library to call strtok()
        > > > > > internally, would you?
        > > > >
        > > > > Sure. Why not?
        > > > Because it means you can't use strtok() yourself?[/color]
        > > Non sequitur.[/color]
        > If the implementation can call strtok() then I can't be sure what state
        > strtok()'s static buffer is in -- it need not be in the state I left it in.[/color]

        The implementation is not allowed to change the state you left it in.
        That's obvious from the semantics of strtok. Whether it calls strtok
        internally is irrelevant, so long as it satisfies that requirement.

        That's the problem with redundant requirements: people look for meaning
        in them.

        --

        Pete Becker
        Dinkumware, Ltd. (http://www.dinkumware.com)

        Comment

        • DrPizza

          #19
          Re: random_shuffle seed

          "Pete Becker" <petebecker@acm .org> wrote in message
          news:3FAB9516.9 6D4EA1C@acm.org ...[color=blue]
          > DrPizza wrote:[color=green]
          > >
          > > "tom_usenet " <tom_usenet@hot mail.com> wrote in message
          > > news:nckkqvsrn5 lghoe2ire026mqv qlvqsr332@4ax.c om...[color=darkred]
          > > > The C standard only says that the implementation of the C library
          > > > won't call them.[/color]
          > > Well, no, it doesn't, it simply says that the implementation shall behave[/color][/color]
          as[color=blue][color=green]
          > > if no library function calls rand. It doesn't specify which library.
          > >[color=darkred]
          > > > Taking the original quote:
          > > > "The implementation shall behave as if no library function calls the
          > > > rand function"
          > > >
          > > > The "library" referred to is the C library, not the C++ one. Just
          > > > because C++ includes the (slightly modified) C library doesn't mean
          > > > that it *is* the C library.[/color]
          > > Upon incorporation into C++, "the library" refers to the C++ library. The[/color][/color]
          C++[color=blue][color=green]
          > > library is the only library there is, so it's the only one it could refer[/color][/color]
          to.[color=blue][color=green]
          > >[/color]
          >
          > Where in the C++ standard do you find this assertion?[/color]

          It's the only thing that the restriction could mean.

          --
          char a[99999],*p=a;main(c,V) char**V;{char*v =c>0?1[V]:V;if(c)for(;(c =*v)&&93^
          c;p+=!(62^c)-!(60^c),*p+=!(4 3^c)-!(45^c),44^c||r ead(0,p,1),46^c ||putchar(*p)
          ,91^c||(v=*p?ma in(-1,v+1),v-1:main(0,v)),++ v);else for(;c+=!(91^*v )-!(93^*v)
          ;++v);return v;} /* drpizza@battlea xe.net brainf*** program as argv[1] */


          Comment

          • Pete Becker

            #20
            Re: random_shuffle seed

            DrPizza wrote:[color=blue]
            >
            > "Pete Becker" <petebecker@acm .org> wrote in message
            > news:3FAB9516.9 6D4EA1C@acm.org ...[color=green]
            > > DrPizza wrote:[color=darkred]
            > > >
            > > > "tom_usenet " <tom_usenet@hot mail.com> wrote in message
            > > > news:nckkqvsrn5 lghoe2ire026mqv qlvqsr332@4ax.c om...
            > > > > The C standard only says that the implementation of the C library
            > > > > won't call them.
            > > > Well, no, it doesn't, it simply says that the implementation shall behave[/color][/color]
            > as[color=green][color=darkred]
            > > > if no library function calls rand. It doesn't specify which library.
            > > >
            > > > > Taking the original quote:
            > > > > "The implementation shall behave as if no library function calls the
            > > > > rand function"
            > > > >
            > > > > The "library" referred to is the C library, not the C++ one. Just
            > > > > because C++ includes the (slightly modified) C library doesn't mean
            > > > > that it *is* the C library.
            > > > Upon incorporation into C++, "the library" refers to the C++ library. The[/color][/color]
            > C++[color=green][color=darkred]
            > > > library is the only library there is, so it's the only one it could refer[/color][/color]
            > to.[color=green][color=darkred]
            > > >[/color]
            > >
            > > Where in the C++ standard do you find this assertion?[/color]
            >
            > It's the only thing that the restriction could mean.
            >[/color]

            Several people have already disagreed with you here, so you are merely
            repeating your position. That's a waste of time.

            --

            Pete Becker
            Dinkumware, Ltd. (http://www.dinkumware.com)

            Comment

            Working...