[TUHS] : C dialects (was: I can't drive 55: "GOTO considered harmful" 55th anniversary)

Dave Horsfall dave at horsfall.org
Tue Mar 14 08:47:24 AEST 2023


On Tue, 14 Mar 2023, Dave Horsfall followed himself up:

> Trivia: I think it was OpenBSD that nobbled gets() to print a warning 
> whenever it was invoked :-)

FreeBSD 10.4 (old, I know):

    c.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main()
    ^~~~
    c.c:2:3: warning: implicit declaration of function 'gets' is invalid in C99
	  [-Wimplicit-function-declaration]
    { gets(); }
      ^
    2 warnings generated.
    /tmp/c-36bc21.o: In function `main':
    c.c:(.text+0x4): warning: warning: this program uses gets(), which is unsafe.
    aneurin% ./c
    warning: this program uses gets(), which is unsafe.
    <CR>
    aneurin% 

On the MacBook (10.13.6 High Sierra):

    c.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
    ^
    c.c:2:3: warning: implicit declaration of function 'gets' is invalid in C99
	  [-Wimplicit-function-declaration]
    { gets(); }
      ^
    2 warnings generated.
    mackie:tmp dave$ ./c
    warning: this program uses gets(), which is unsafe.
    <CR>

    And it core-dumped,,,


(I don't have access to my Penguin/OS lapdog right now.)

I think that it's trying to tel me something :-)

-- Dave


More information about the TUHS mailing list