Re: Theodore Adorno, a prophet of data systems design

Discussion in 'C Programming' started by pete, Jan 11, 2004.

  1. pete

    pete Guest

    Richard Heathfield wrote:

    > Rule 1) Do not invoke undefined behaviour,
    > at all, ever, in any of your C code.


    That's the key to understanding the difference between code
    which invokes undefined behavior and code which has behavior
    not defined by the standard.

    There really *is* something wrong with code that invokes
    undefined behavior. Code which invokes undefined behavior,
    can't be part of a correct program,
    not if the undefined behavior code is reachable, anyway.

    On the other hand, there should be *some* situation
    where it's OK to invoke an implementation defined function.

    --
    pete
    pete, Jan 11, 2004
    #1
    1. Advertising

  2. pete

    Ben Pfaff Guest

    pete <> writes:

    > There really *is* something wrong with code that invokes
    > undefined behavior. Code which invokes undefined behavior,
    > can't be part of a correct program,
    > not if the undefined behavior code is reachable, anyway.


    That's far too generalized. I write code that, technically, has
    undefined behavior, all the time. I know exactly what I'm doing
    and why I'm writing it and why I can't write it reasonably in
    another way. Restricting everyone to writing strictly conforming
    code all the time would render C useless for many purposes.
    --
    int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
    \n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
    );while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p\
    );}return 0;}
    Ben Pfaff, Jan 11, 2004
    #2
    1. Advertising

  3. pete

    pete Guest

    Ben Pfaff wrote:
    >
    > pete <> writes:
    >
    > > There really *is* something wrong with code that invokes
    > > undefined behavior. Code which invokes undefined behavior,
    > > can't be part of a correct program,
    > > not if the undefined behavior code is reachable, anyway.

    >
    > That's far too generalized. I write code that, technically, has
    > undefined behavior, all the time. I know exactly what I'm doing
    > and why I'm writing it and why I can't write it reasonably in
    > another way. Restricting everyone to writing strictly conforming
    > code all the time would render C useless for many purposes.


    He didn't say "strictly conforming".
    What kind of undefined behaviors are you talking about ?

    --
    pete
    pete, Jan 11, 2004
    #3
  4. [Crosspost to comp.lang.c noted and honoured, but I'm not entirely sure
    whether clc wants any part of this thread!]

    pete wrote:

    > Richard Heathfield wrote:
    >
    >> Rule 1) Do not invoke undefined behaviour,
    >> at all, ever, in any of your C code.

    >
    > That's the key to understanding the difference between code
    > which invokes undefined behavior and code which has behavior
    > not defined by the standard.
    >
    > There really *is* something wrong with code that invokes
    > undefined behavior. Code which invokes undefined behavior,
    > can't be part of a correct program,
    > not if the undefined behavior code is reachable, anyway.


    Certainly true.

    > On the other hand, there should be *some* situation
    > where it's OK to invoke an implementation defined function.


    Agreed. At that point, however, you are no longer programming in C, but in
    C-plus-extensions, and that's a different game (unless you really mean the
    standard C meaning of "implementation-defined", in which case I don't quite
    see how it's relevant, since "implementation-defined" and "undefined" are
    two very separate ideas).

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
    Richard Heathfield, Jan 11, 2004
    #4
  5. pete

    pete Guest

    Richard Heathfield wrote:
    >
    > [Crosspost to comp.lang.c noted and honoured, but I'm not entirely sure
    > whether clc wants any part of this thread!]
    >
    > pete wrote:
    >
    > > Richard Heathfield wrote:
    > >
    > >> Rule 1) Do not invoke undefined behaviour,
    > >> at all, ever, in any of your C code.

    > >
    > > That's the key to understanding the difference between code
    > > which invokes undefined behavior and code which has behavior
    > > not defined by the standard.
    > >
    > > There really *is* something wrong with code that invokes
    > > undefined behavior. Code which invokes undefined behavior,
    > > can't be part of a correct program,
    > > not if the undefined behavior code is reachable, anyway.

    >
    > Certainly true.
    >
    > > On the other hand, there should be *some* situation
    > > where it's OK to invoke an implementation defined function.

    >
    > Agreed. At that point, however, you are no longer programming in C,


    I disagree. When your program calls a function,
    which has been supplied by a conforming C implementation,
    then that call is done according to the rules of C,
    on that implementation.
    When your code invokes indefined behavior,
    then you are no longer programming in C on any implementation.

    > but in C-plus-extensions, and that's a different game


    I'm definitely not talking about portable code.

    > (unless you really mean the standard C meaning of
    > "implementation-defined", in which case I don't quite
    > see how it's relevant,
    > since "implementation-defined" and "undefined" are
    > two very separate ideas).


    I mean a function supplied by the implementation,
    like a clear screen function.

    You *do* recall the comp.std.c consensus on the issue
    of whether or a not a program which calls an implementation
    defined clear screen function, is defined or undefined ?

    --
    pete
    pete, Jan 11, 2004
    #5
  6. pete

    pete Guest

    undefined vs. not covered by the standard, was Re: Theodore Adorno

    pete wrote:
    >
    > Richard Heathfield wrote:
    > >
    > > [Crosspost to comp.lang.c noted and honoured,
    > > but I'm not entirely sure
    > > whether clc wants any part of this thread!]


    Followup set to comp.std.c

    > >
    > > pete wrote:
    > >
    > > > Richard Heathfield wrote:
    > > >
    > > >> Rule 1) Do not invoke undefined behaviour,
    > > >> at all, ever, in any of your C code.
    > > >
    > > > That's the key to understanding the difference between code
    > > > which invokes undefined behavior and code which has behavior
    > > > not defined by the standard.


    It might be better if I said "not covered by the standard"

    > > >
    > > > There really *is* something wrong with code that invokes
    > > > undefined behavior. Code which invokes undefined behavior,
    > > > can't be part of a correct program,
    > > > not if the undefined behavior code is reachable, anyway.

    > >
    > > Certainly true.
    > >
    > > > On the other hand, there should be *some* situation
    > > > where it's OK to invoke an implementation defined function.

    > >
    > > Agreed. At that point, however, you are no longer programming in C,

    >
    > I disagree. When your program calls a function,
    > which has been supplied by a conforming C implementation,
    > then that call is done according to the rules of C,
    > on that implementation. When your code invokes


    > indefined


    Should be "undefined". That's a bad typo to make in this thread.

    > behavior, then you are no longer programming in C
    > on any implementation.
    >
    > > but in C-plus-extensions, and that's a different game

    >
    > I'm definitely not talking about portable code.
    >
    > > (unless you really mean the standard C meaning of
    > > "implementation-defined", in which case I don't quite
    > > see how it's relevant,
    > > since "implementation-defined" and "undefined" are
    > > two very separate ideas).

    >
    > I mean a function supplied by the implementation,
    > like a clear screen function.
    >
    > You *do* recall the comp.std.c consensus on the issue
    > of whether or a not a program which calls an implementation


    > defined


    Since the topic is terminology, to be clearer,
    I think I should have said "supplied" instead of "defined".

    > clear screen function, is defined or undefined ?


    --
    pete
    pete, Jan 11, 2004
    #6
  7. pete wrote:

    > Richard Heathfield wrote:
    >>
    >> [Crosspost to comp.lang.c noted and honoured, but I'm not entirely sure
    >> whether clc wants any part of this thread!]
    >>
    >> pete wrote:
    >>
    >>
    >> > On the other hand, there should be *some* situation
    >> > where it's OK to invoke an implementation defined function.

    >>
    >> Agreed. At that point, however, you are no longer programming in C,

    >
    > I disagree. When your program calls a function,
    > which has been supplied by a conforming C implementation,
    > then that call is done according to the rules of C,
    > on that implementation.


    True enough. All right, badly phrased! :) The point is that the behaviour
    of the program is no longer governed by the C standard.

    > When your code invokes indefined behavior,
    > then you are no longer programming in C on any implementation.
    >
    >> but in C-plus-extensions, and that's a different game

    >
    > I'm definitely not talking about portable code.


    That's what I thought.

    >> (unless you really mean the standard C meaning of
    >> "implementation-defined", in which case I don't quite
    >> see how it's relevant,
    >> since "implementation-defined" and "undefined" are
    >> two very separate ideas).

    >
    > I mean a function supplied by the implementation,
    > like a clear screen function.


    So do I.

    >
    > You *do* recall the comp.std.c consensus on the issue
    > of whether or a not a program which calls an implementation
    > defined clear screen function, is defined or undefined ?


    No. I recall a discussion, but not a consensus. Do you have any kind of
    handle on high-success-probability search criteria? A message ID would be
    fabulous.

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
    Richard Heathfield, Jan 11, 2004
    #7
  8. pete

    Ben Pfaff Guest

    pete <> writes:

    > Ben Pfaff wrote:
    >>
    >> pete <> writes:
    >>
    >> > There really *is* something wrong with code that invokes
    >> > undefined behavior. Code which invokes undefined behavior,
    >> > can't be part of a correct program,
    >> > not if the undefined behavior code is reachable, anyway.

    >>
    >> That's far too generalized. I write code that, technically, has
    >> undefined behavior, all the time. I know exactly what I'm doing
    >> and why I'm writing it and why I can't write it reasonably in
    >> another way. Restricting everyone to writing strictly conforming
    >> code all the time would render C useless for many purposes.

    >
    > He didn't say "strictly conforming".
    > What kind of undefined behaviors are you talking about ?


    Such things as using non-standard headers and libraries.
    --
    "IMO, Perl is an excellent language to break your teeth on"
    --Micah Cowan
    Ben Pfaff, Jan 11, 2004
    #8
  9. On Sun, 11 Jan 2004 07:19:46 GMT, in comp.lang.c , pete
    <> wrote:

    >Ben Pfaff wrote:


    >> That's far too generalized. I write code that, technically, has
    >> undefined behavior, all the time. I know exactly what I'm doing
    >> and why I'm writing it and why I can't write it reasonably in
    >> another way. Restricting everyone to writing strictly conforming
    >> code all the time would render C useless for many purposes.

    >
    >He didn't say "strictly conforming".
    >What kind of undefined behaviors are you talking about ?


    I would have thought that Ben was probably talking about anything that
    made use of system services, databases, gui features etc.

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    Mark McIntyre, Jan 11, 2004
    #9
  10. pete

    pete Guest

    Richard Heathfield wrote:
    >
    > pete wrote:


    > > You *do* recall the comp.std.c consensus on the issue
    > > of whether or a not a program which calls an implementation
    > > defined clear screen function, is defined or undefined ?

    >
    > No. I recall a discussion, but not a consensus.
    > Do you have any kind of handle on high-success-probability
    > search criteria? A message ID would be fabulous.


    After further consideration, I'd rather not:
    http://groups.google.com/groups?selm=

    My apologies to all.

    --
    pete
    pete, Jan 12, 2004
    #10
    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. Replies:
    3
    Views:
    248
    John F
    Mar 3, 2007
  2. Replies:
    0
    Views:
    276
  3. Replies:
    4
    Views:
    303
    Alex Hunsley
    Mar 10, 2007
  4. moslim
    Replies:
    0
    Views:
    279
    moslim
    Mar 14, 2007
  5. moslim
    Replies:
    1
    Views:
    239
    Michael Bentley
    Mar 14, 2007
Loading...

Share This Page