Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.os.linux.advocacy
Date : 09. Mar 2024, 05:31:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <usgl6d$1rnlb$3@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Pan/0.155 (Kherson; c0bf34e gitlab.gnome.org/GNOME/pan.git; x86_64-pc-linux-gnu)
On 9 Mar 2024 03:14:10 GMT, rbowman <bowman@montana.com> wrote in
<l522g2FqgibU6@mid.individual.net>:

On Fri, 8 Mar 2024 15:41:13 -0500, DFS wrote:
 
Sorry.  That's ALL from a crlf inserted by the newsreader.  It compiled
cleanly after I took it out.
 Yup...
 In production code I'd likely do
 char* sentence;
 sentence = strdup("Once you try it, you'll see it doesn't need spice.");
if (sentence == NULL) {
    printf("strdup() failed: %s", strerror(errno));
    return -1;
}
Seems like a lot of work that could be handled by
char sentence[] = "initializer";
Am I missing something?

 Admittedly is the implied malloc() failed the odds of it printing
anything aren't great but might as well try. I probably would use
strtok_r() in production if there was a remote possibility that there
would be another nested strtok(). That's ruined more than one
programmer's day.
 
--
-v

Date Sujet#  Auteur
7 Mar 24 * OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it26DFS
7 Mar 24 `* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it25rbowman
8 Mar 24  +* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it23DFS
8 Mar 24  i`* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it22rbowman
8 Mar 24  i +* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it8DFS
8 Mar 24  i i+* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it4DFS
9 Mar 24  i ii`* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it3rbowman
9 Mar 24  i ii `* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it2vallor
9 Mar 24  i ii  `- Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it1rbowman
9 Mar 24  i i`* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it3rbowman
9 Mar 24  i i `* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it2vallor
9 Mar 24  i i  `- Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it1rbowman
9 Mar 24  i `* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it13DFS
9 Mar 24  i  `* Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it12rbowman
9 Mar 24  i   +- Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it1DFS
9 Mar 24  i   `* Re: OT programming challenge:10rbowman
10 Mar 24  i    `* Re: OT programming challenge:9Chris Ahlstrom
10 Mar 24  i     `* Re: OT programming challenge:8rbowman
10 Mar 24  i      +* Re: 16-bit floating-point.5rbowman
10 Mar 24  i      i`* Re: Some examples ?4rbowman
11 Mar 24  i      i `* Re: How does your Pico "make sure everything is working" ?3rbowman
11 Mar 24  i      i  `* Re: I was burning EEPROMs for handheld devices back in 1984, Orem Utah.2rbowman
11 Mar 24  i      i   `- Re: Had any good Blutwurst lately ?1rbowman
10 Mar 24  i      +- Re: OT programming challenge:1Chris Ahlstrom
10 Mar 24  i      `- Re: 16-bit floating-point.1DFS
9 Mar 24  `- Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it1DFS

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal