Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: Is something wrong with the compiler ? Message-ID: Date: 7 Oct 90 00:55:10 GMT References: <1895@tuvie> <645@demott.COM> <1903@tuvie> <26875@mimsy.umd.edu> <1990Oct6.194120.27656@mintaka.lcs.mit.edu> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 64 In-reply-to: wald@theory.lcs.mit.edu's message of 6 Oct 90 19:41:20 GMT In article <1990Oct6.194120.27656@mintaka.lcs.mit.edu> wald@theory.lcs.mit.edu (David Wald) writes: | In article <26875@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes: | >In short, when the ANSI standard says that the result of an operation | >is undefined, it means UNDEFINED. The computer can do anything (like | >turn into a flower)---the system does not have to do anything remotely | >reasonable. | | I'm continually amused by the examples people give for undefined and | implementation-defined behavior. Can we get a list together, possibly | to be incorporated into an Emacs macro? | | Examples: | | Melt your screen; | Call your mother; | Send nasty notes to your boss; | ...? I tend to use delete the offending source file, after running into an alpha version of a compiler that did that when given a certain invalid switch. | ``The `#pragma' command is specified in the ANSI standard to have an | arbitrary implementation-defined effect. In the GNU C preprocessor, | `#pragma' first attempts to run the game `rogue'; if that fails, it | tries to run the game `hack'; if that fails, it tries to run GNU Emacs | displaying the Tower of Hanoi; if that fails, it reports a fatal | error. In any case, preprocessing does not continue.'' | -- from the manual for the GCC preprocessor (GCC version 1.34) Gcc now does recognize at least one pragma (#pragma once). Here's what's in the source, where it keeps the code around, but #if'ed out: #if 0 /* This was a fun hack, but #pragma seems to start to be useful. By failing to recognize it, we pass it through unchanged to cc1. */ /* * the behavior of the #pragma directive is implementation defined. * this implementation defines it as follows. */ do_pragma () { close (0); if (open ("/dev/tty", O_RDONLY, 0666) != 0) goto nope; close (1); if (open ("/dev/tty", O_WRONLY, 0666) != 1) goto nope; execl ("/usr/games/hack", "#pragma", 0); execl ("/usr/games/rogue", "#pragma", 0); execl ("/usr/new/emacs", "-f", "hanoi", "9", "-kill", 0); execl ("/usr/local/emacs", "-f", "hanoi", "9", "-kill", 0); nope: fatal ("You are in a maze of twisty compiler features, all different"); } #endif -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 Do apple growers tell their kids money doesn't grow on bushes?