🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9510

Adding new keywords (Re: Functions that never return)

#9510
From: Guido van Rossum
Date: Tue, 07 Oct 1986 08:09
34 lines
2460 bytes
In article <86900064@haddock> karl@haddock writes:
>Adding a new keyword will not obsolete any programs except those that use it
>as an identifier.  Such programs are easy to upgrade ("#define dead id_dead"
>is almost sufficient, if you're lazy).  Conversely, programs written for the
>new language can be downgraded for old compilers with "#define dead void" --
>no such simple fix is available if "goto" acquires new semantics.

Sorry, Karl, it's not that easy.  The "#define dead id_dead" trick may
fail horribly if the keyword is used in the standard include files
provided by the implementation.

For example, take ANSI C: exit and abort are declared in <stdlib.c> (*).
If this file is included in my program, which also makes use of a
variable called 'dead', and an implementation chooses to declare exit
and abort as 'dead', I have to find out pretty exactly where 'dead' is
used as what before I know where to add "#define dead id_dead": before
line 1 of my file will cause a syntax error in <stdlib.h>, after all
include files may be too late (if my own include files also reference my
variable 'dead'); I may end up having to reshuffle the #include
directives or even use the editor to change of all occurrences of 'dead'
in my sources to 'id_dead' (probably also changing some output strings
in the process!).

This is not an imaginary problem: I've been fighting it in the Apple MPW
C compiler, which has new keywords 'extended' and 'comp' and uses them
extensively in <math.h>.  I interpret my ANSI draft (*) as *forbidding*
the addition of new reserved words to a strictly conforming
implementation; I hope that's still there in the "final" draft.

-- 
	Guido van Rossum, CWI, Amsterdam <guido@mcvax.uucp>

(*) This refers to the May, 1986 draft of the ANSI C standard.
Technical Details
Message-ID: <7096@boring.mcvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!guido
References: <3274@watmath.UUCP> <86900064@haddock>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!guido
From: guido@mcvax.uucp (Guido van Rossum)
Newsgroups: net.lang.c
Subject: Adding new keywords (Re: Functions that never return)
Message-ID: <7096@boring.mcvax.UUCP>
Date: Tue, 7-Oct-86 04:09:20 EDT
Article-I.D.: boring.7096
Posted: Tue Oct  7 04:09:20 1986
Date-Received: Wed, 8-Oct-86 06:38:07 EDT
References: <3274@watmath.UUCP> <86900064@haddock>
Reply-To: guido@boring.uucp (Guido van Rossum)
Organization: "Stamp Out BASIC" Committee, CWI, Amsterdam
Lines: 33
Summary: It's not that easy to upgrade
Apparently-To: rnews@mcvax