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


Groups > comp.lang.c > #140277

Re: Compiler tests

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Compiler tests
Date 2019-01-25 18:40 +0000
Organization A noiseless patient Spider
Message-ID <87h8dwwph1.fsf@bsb.me.uk> (permalink)
References (16 earlier) <q2c4p0$6i3$1@dont-email.me> <871s51y7aq.fsf@bsb.me.uk> <q2enc0$256$1@dont-email.me> <87va2dvt86.fsf@bsb.me.uk> <q2f1jg$reo$1@dont-email.me>

Show all headers | View raw


David Brown <david.brown@hesbynett.no> writes:

> On 25/01/2019 13:04, Ben Bacarisse wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>> 
>>> On 25/01/2019 00:17, Ben Bacarisse wrote:
>>>> David Brown <david.brown@hesbynett.no> writes:
>>>>
>>>>> On 23/01/2019 22:54, Ben Bacarisse wrote:
>>>> <snip>
>>>>>> In Algol 68 (one of the first languages to get this right)
>>>>>>
>>>>>>   INT x = f(y);
>>>>>>
>>>>>> calls f at run-time (optimisations aside) and names the resulting value
>>>>>> x.  You can't take the address of x because it's has no storage (again
>>>>>> "as if rules" aside), and you can't alter x because it is not a
>>>>>> variable.
>>>>>
>>>>> I don't see how that differs from C++ :
>>>>>
>>>>> 	const int x = f(y);
>>>>>
>>>>> You /can/ take the address of x, but that doesn't matter.
>>>>
>>>> Hmm...  why does it not matter?  The point is that the C++ statement
>>>> says something different to the Algol 68 statement.  In the C++ case, x
>>>> must have an observable representation because x denotes an object not a
>>>> value.  It's just nice to be able to write what one means without being
>>>> obliged to say more.
>>>
>>> In what circumstances would you have a named constant value that does
>>> not have a representation?  Does an Algol "INT" represent an abstract
>>> integer type, perhaps with unlimited size, rather than a concrete type?
>>>  (That would be interesting.)
>> 
>> Generalising rather too much, a type, concrete or not, will usually
>> specify a set of values.  There is no need for a representation, in the
>> way the term is used in C, even when the range of values is limited.
>> 
>> I am not sure what you mean with the concrete/abstract distinction here.
>> The range of INT values in Algol 68 will usually be chosen so that they
>> can be efficiently represented on the hardware that is being targeted.
>
> The terms "abstract" and "concrete" can be used to mean a lot of things.
>
> Here I am thinking of the distinction between an "integer", which is a
> mathematical concept, and something like an "int", which is a specific
> type in C.  It appears you are saying Algol INT is concrete enough to
> have a specific range, but abstract enough that there is no specified
> representation.

If you want to put it that way.  I'd say it's abstract.  The fact that
we might define an "hour" type to be 0..23 does not make it concrete in
my book, but as you know, I'm not a fan of arguing over vague words.

<snip>
> I am having a lot of difficulty appreciating why you see the Algol
> constant as any different, as long as there is a clear mapping between
> the values and the representations, and they cover the same ranges.  (It
> might not be a one-to-one mapping, considering oddities like signed
> zeros.)

OK.  And I am having trouble appreciating why you don't see naming a
value as different from naming a non-modifiable lvalue.  Is there much
point in either of us trying to find out?  I suspect is just a different
point of view.

>>> I agree that it is nice to be able to write what you mean - no more and
>>> no less.  But it is rarely possible in programming to get exactly
>>> that.
>> 
>> Sure.  Never exactly that.  But C is particularly limited in this
>> regard.  (That's not surprising and I am not "having a go" at C.)
>
> Agreed.  (And nor I am "defending" C.)
>
>> 
>> C is an old, low-level language, designed for a very specific purpose.
>
> It is an old language, but it is a high-level language, at least as I
> view the term.  It is defined in terms of an abstract machine, often
> discussing object values rather than representations or
> implementations.

The representation options are explicit and you can test them.  You can
examine the representation and play tricks with it, even in portable
code.

>  It has the "as if" rule.

Indeed, so even the "representation" may be faked.  C has to /appear/ to
use plain binary bits for positive integers, but that does not stop it
being low-level in my book.

> You don't specify exactly what the code
> should do, you describe how the abstract machine could get the results
> you want and let the compiler figure out how to achieve that.  It is
> certainly a very low level high level language, but if I were to
> classify it as either high level or low level, I'd say high level.  (For
> low-level languages, I'd consider assembly, obviously, and also bytecode
> like p-code, and PLC languages like Ladder and IL.)

I don't know those (the last two).  I might take a look because I'd like
to see how low you need to go to be low-level in your book.

<snip>
>> Not being able to take the address is not the issue.  The issue is
>> naming a value.  Since you can't do that (in any general way) in C I
>> would not expect the readers of c.l.c to be too worried by it (I'm not),
>> but how many would say that they write C code with the intent of naming
>> a value using various means to get round the restriction:
>> 
>>   enum { max_types = 1024 };
>> 
>>   #define begin_token "begin"
>> 
>>   const double pi = 3.1415;
>> 
>> ?  I would guess most.
>> 
>
> I'd say these /are/ all ways of naming constants of different types.  I
> guess you are naming something that has a value, rather than naming the
> value.   But I'd also say that makes more sense.  Surely a thing should
> only have one name - if we were to say "max_types is the name of the
> value 1024", then we could not then also say "max_objects is the name of
> the value 1024".  Or am I reading too much into this?

I don't really see what your point is.  My point seems (to me) to be so
simple and reasonable that I don't understand your objection.  I don't
want to change C, so there is no need to say "C can manage" -- I know it
can, but none the less, there is no uniform way to name a value in C.

Algol 68 makes all this very explicit:

  INT x = 42;   CO x names a value OC
  INT x := 42;  CO x names a location that can hold a value OC

The latter is a short-hand for

  REF INT x = LOC INT := 42

roughly: LOC INT is a locally allocated (stack) int assigned 42, and the
name x refers to that location.

-- 
Ben.

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


Thread

Compiler tests Bart <bc@freeuk.com> - 2019-01-20 00:03 +0000
  Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-20 16:52 +1300
    Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-20 10:27 +0100
      Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-20 12:37 +0100
        Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-20 13:08 +0000
          Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-20 15:02 +0000
            Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-20 17:31 +0100
              Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-20 17:08 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-20 21:40 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-20 22:41 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 00:39 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-21 00:36 +0000
                Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-21 16:33 +1300
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-21 11:58 +0000
                Re: Compiler tests Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-01-21 04:15 -0800
                Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-22 07:53 +1300
                Re: Compiler tests BGB <cr88192@hotmail.com> - 2019-01-23 01:15 -0600
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 12:00 +0000
                Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-24 08:13 +1300
                Re: Compiler tests BGB <cr88192@hotmail.com> - 2019-01-23 13:30 -0600
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 08:22 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-21 12:23 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 14:42 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-21 14:17 +0000
                Re: Compiler tests Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-01-21 12:46 -0800
                You guys really, really need to get a room (Was: Compiler tests) gazelle@shell.xmission.com (Kenny McCormack) - 2019-01-24 14:05 +0000
          Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-20 17:27 +0100
            Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-20 17:19 +0000
              Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 09:44 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-21 12:49 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 15:31 +0100
                Re: Compiler tests jacobnavia <jacob@jacob.remcomp.fr> - 2019-01-21 14:38 +0100
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-21 15:15 +0100
                Re: Compiler tests jacobnavia <jacob@jacob.remcomp.fr> - 2019-01-21 16:05 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 16:39 +0100
                Re: Compiler tests Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-01-21 12:51 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-22 00:16 +0000
                Re: Compiler tests jacobnavia <jacob@jacob.remcomp.fr> - 2019-01-22 08:43 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-22 12:31 +0000
                Re: Compiler tests jacobnavia <jacob@jacob.remcomp.fr> - 2019-01-22 17:49 +0100
                Re: Compiler tests jacobnavia <jacob@jacob.remcomp.fr> - 2019-01-23 11:04 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 11:18 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-21 15:35 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-21 15:49 +0000
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-21 17:42 +0100
                Re: Compiler tests BGB <cr88192@hotmail.com> - 2019-01-23 03:18 -0600
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 11:11 +0100
                Re: Compiler tests BGB <cr88192@hotmail.com> - 2019-01-23 12:18 -0600
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 13:56 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-22 10:55 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-22 12:07 +0000
                Re: Compiler tests fir <profesor.fir@gmail.com> - 2019-01-22 04:29 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-22 12:52 +0000
                Re: Compiler tests mark.bluemel@gmail.com - 2019-01-22 05:04 -0800
                Re: Compiler tests fir <profesor.fir@gmail.com> - 2019-01-22 05:18 -0800
                Re: Compiler tests fir <profesor.fir@gmail.com> - 2019-01-22 05:45 -0800
                Re: Compiler tests fir <profesor.fir@gmail.com> - 2019-01-22 05:35 -0800
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-22 15:10 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-22 17:30 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-22 23:02 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-22 23:14 +0000
                Re: Compiler tests Keith Thompson <kst-u@mib.org> - 2019-01-22 15:45 -0800
                Re: Compiler tests Robert Wessel <robertwessel2@yahoo.com> - 2019-01-22 17:57 -0600
                Re: Compiler tests Keith Thompson <kst-u@mib.org> - 2019-01-22 16:36 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 01:37 +0000
                Re: Compiler tests Keith Thompson <kst-u@mib.org> - 2019-01-22 18:53 -0800
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 09:42 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 09:22 +0100
                Re: Compiler tests James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-01-23 08:52 -0500
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 15:13 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 14:33 +0000
                Re: Compiler tests James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-01-23 07:30 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 16:05 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 17:17 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 16:29 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 22:04 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 21:50 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-24 10:45 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-24 11:55 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-24 13:58 +0100
                Re: Compiler tests mark.bluemel@gmail.com - 2019-01-24 05:07 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-24 14:10 +0000
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-24 14:18 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-24 15:51 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-24 15:44 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-24 17:32 +0000
                Re: Compiler tests scott@slp53.sl.home (Scott Lurndal) - 2019-01-24 19:07 +0000
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-24 20:14 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-24 22:24 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-24 22:46 +0000
                Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-25 12:34 +1300
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 01:01 +0000
                Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-25 14:15 +1300
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 10:05 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 14:51 +0000
                Re: Compiler tests Mateusz Viste <mateusz@wont.tell> - 2019-01-25 09:48 +0000
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 10:56 +0100
                Re: Compiler tests Mateusz Viste <mateusz@wont.tell> - 2019-01-25 12:08 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 13:28 +0100
                Re: Compiler tests Mateusz Viste <mateusz@wont.tell> - 2019-01-25 13:33 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 15:38 +0100
                Re: Compiler tests Mateusz Viste <mateusz@wont.tell> - 2019-01-25 15:08 +0000
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 13:53 +0000
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 12:25 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 10:03 +0100
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 10:08 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 11:14 +0100
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 12:02 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 13:37 +0100
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 13:58 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 14:26 +0100
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 15:01 +0100
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 15:42 +0100
                Re: Compiler tests Keith Thompson <kst-u@mib.org> - 2019-01-25 10:25 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 14:37 +0000
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 16:33 +0100
                Re: Compiler tests Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-01-25 07:44 -0800
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 17:53 +0100
                Re: Compiler tests Keith Thompson <kst-u@mib.org> - 2019-01-25 10:33 -0800
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 20:43 +0100
                Re: Compiler tests Keith Thompson <kst-u@mib.org> - 2019-01-25 12:17 -0800
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 18:31 +0000
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 20:41 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 21:19 +0000
                Re: Compiler tests Ian Collins <ian-news@hotmail.com> - 2019-01-26 10:24 +1300
                Re: Compiler tests "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-25 22:27 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 22:39 +0000
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-25 18:46 +0000
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 12:43 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 14:37 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 14:19 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 15:47 +0100
                Re: Compiler tests Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-01-25 07:17 -0800
                Re: Compiler tests Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-02-03 07:28 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-02-03 12:35 +0100
                Re: Compiler tests Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-02-03 21:47 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-02-03 22:57 +0100
                Re: Compiler tests Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-01-24 06:47 -0800
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-23 20:22 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 22:12 +0100
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-23 21:54 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-24 11:41 +0100
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-24 23:17 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 11:11 +0100
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-25 12:04 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 14:05 +0100
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-25 18:40 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-25 22:36 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-25 22:15 +0000
                Re: Compiler tests scott@slp53.sl.home (Scott Lurndal) - 2019-01-25 14:48 +0000
                Re: Compiler tests scott@slp53.sl.home (Scott Lurndal) - 2019-01-25 14:46 +0000
                Re: Compiler tests Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-25 17:48 +0000
                Re: Compiler tests James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-01-23 08:23 -0800
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 16:41 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 16:18 +0000
                Re: Compiler tests David Brown <david.brown@hesbynett.no> - 2019-01-23 17:28 +0100
                Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-23 20:23 +0000
                Re: Compiler tests Robert Wessel <robertwessel2@yahoo.com> - 2019-01-22 17:52 -0600
          Re: Compiler tests Bart <bc@freeuk.com> - 2019-01-20 20:17 +0000
    Re: Compiler tests BGB <cr88192@hotmail.com> - 2019-01-21 00:13 -0600

csiph-web