Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #163803

Re: Does this program have the specified behavior?

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Does this program have the specified behavior?
Date 2021-12-12 09:29 -0800
Organization A noiseless patient Spider
Message-ID <86sfux68b2.fsf@linuxsc.com> (permalink)
References (4 earlier) <3e59b2b4-88f9-4bd1-8cf7-eb7baee8c214n@googlegroups.com> <86y24s7q7i.fsf@linuxsc.com> <G7IsJ.152140$831.93@fx40.iad> <86czm36nwv.fsf@linuxsc.com> <87k0gaacay.fsf@nosuchdomain.example.com>

Show all headers | View raw


Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> [...]
>
>> In the context of the C standard, the word "behavior" refers to a
>> specification, not an action.  In other words the "behavior" of
>> a program is what the program /should/ do, not necessarily what the
>> program /will/ do, if and when it is executed.
>
> [...]
>
> The standard's definition of "behavior" is "external appearance or
> action".

It is.  Despite that, in how the C standard uses the term it refers
to a specification for what should happen, not what actually does
happen.  A program like this

    int
    main( void ){
        unsigned x = 1;
        return  x == 0;
    }

has defined behavior, whether the program is ever run or not, or
even whether the program is ever compiled.  Some text in the C
standard is guilty, to be sure, of some sloppy usage in this
regard, but in context it's clear that "behavior" means a
description or specification of an external appearance or
action, and not an actual appearance or action.  For example,
if a program has "undefined behavior", an implementation is
free to do what it chooses.  That's a specification of what
appearances or actions are allowed (namely, anything at all),
not a statement of what appearances or actions take place.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Do this program have the specified behavior? olcott <NoOne@NoWhere.com> - 2021-11-16 21:33 -0600
  Does this program have the specified behavior? olcott <NoOne@NoWhere.com> - 2021-11-16 22:46 -0600
    Re: Does this program have the specified behavior? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-11-16 21:12 -0800
      Re: Does this program have the specified behavior? Mark Bluemel <mark.bluemel@gmail.com> - 2021-11-17 00:28 -0800
        Re: Does this program have the specified behavior? olcott <NoOne@NoWhere.com> - 2021-11-17 08:33 -0600
        Re: Does this program have the specified behavior? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-10 01:40 -0800
          Re: Does this program have the specified behavior? Richard Damon <Richard@Damon-Family.org> - 2021-12-10 07:56 -0500
            Re: Does this program have the specified behavior? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-11 09:40 -0800
              Re: Does this program have the specified behavior? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-12-11 16:37 -0800
                Re: Does this program have the specified behavior? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-12 09:29 -0800
          Re: Does this program have the specified behavior? antispam@math.uni.wroc.pl - 2021-12-11 19:38 +0000
            Re: Does this program have the specified behavior? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-12-11 16:45 -0800
            Re: Does this program have the specified behavior? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-12 08:53 -0800
    Re: Does this program have the specified behavior? Richard Damon <Richard@Damon-Family.org> - 2021-11-17 06:53 -0500
      Re: Does this program have the specified behavior? olcott <NoOne@NoWhere.com> - 2021-11-17 08:49 -0600
        Re: Does this program have the specified behavior? Juha Nieminen <nospam@thanks.invalid> - 2021-11-18 06:32 +0000
          Re: Does this program have the specified behavior? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-18 11:15 +0000
            Re: Does this program have the specified behavior? olcott <NoOne@NoWhere.com> - 2021-11-18 08:59 -0600
          Re: Does this program have the specified behavior? olcott <NoOne@NoWhere.com> - 2021-11-18 08:58 -0600
    Re: Does this program have the specified behavior? Anurag Ranjan <anuragranjan630@gmail.com> - 2021-11-17 22:00 +0000

csiph-web