Deutsch   English   Français   Italiano  
<l520v9FqgibU5@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rbowman <bowman@montana.com>
Newsgroups: comp.os.linux.advocacy
Subject: Re: OT programming challenge: fastest/best/shortest C program to
 jumble a sentence, then restore it
Date: 9 Mar 2024 02:48:10 GMT
Lines: 31
Message-ID: <l520v9FqgibU5@mid.individual.net>
References: <65e9cad3$0$4689$882e4bbb@reader.netnews.com>
	<l4ufsbF9kdnU4@mid.individual.net> <usf2m9$1n0jh$2@dont-email.me>
	<l518d6FmepqU1@mid.individual.net> <usfs1a$1svs6$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 0+UEFEdpkHFhmyZyZwibcABSaP1zqndUMygLmQyH+YmWt0Exfg
Cancel-Lock: sha1:Kq1jjuuZ/qPulVS9MDnFuGfYcj0= sha256:bBqzxn0lfRwmRHN7tSCa/ukncMUssFfU9iq5npAbEyI=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
Bytes: 1860

On Fri, 8 Mar 2024 15:22:06 -0500, DFS wrote:

> FYI:

Obviously you didn't put it back together after word wrap broke it up.

gcc -pedantic -Wall -Wcast-qual -Wmissing-prototypes -Wshadow  shuffle.c -
o shuffle 

runs with no errors or warnings. If you throw in -std=c99 

gcc -std=c99  shuffle.c -o shuffle
shuffle.c: In function ‘main’:
shuffle.c:8:22: warning: implicit declaration of function ‘strdup’; did 
you mean ‘strcmp’? [-Wimplicit-function-declaration]
    8 |     char* sentence = strdup("Once you try it, you'll see it 
doesn't need spice.");
      |                      ^~~~~~
      |                      strcmp
shuffle.c:8:22: warning: initialization of ‘char *’ from ‘int’ makes 
pointer from integer without a cast [-Wint-conversion]

Why? you might ask? ISO C99 doesn't include strdup although it's strange 
it pulls strcmp out of its ass.

gcc -std=gnu99  shuffle.c -o shuffle

works fine.