Ancestors

Toot

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:58

My new C programming book is slowly taking shape. If you want to learn along, let's start with the basics of control flow:

http://godbolt.org/z/3GerY3zEc

1/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Descendants

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:58

From there, we can progress to function definitions and lexical scopes:

https://godbolt.org/z/GevPGhnYc

2/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:59

Of course, no C tutorial is complete without an explanation of basic loops:

  1. https://godbolt.org/z/oshh599M1

  1. https://godbolt.org/z/ff4a9coPY

3/5

=> View attached media | View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:59

It is also important to understand switch() statements:

https://godbolt.org/z/MqGb63x69

4/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by lcamtuf :verified: :verified: :verified: on 2025-01-08 at 19:59

But the most convenient feature of C is line numbering:

https://godbolt.org/z/dfsKGqYGz

5/5

=> View attached media

=> More informations about this toot | More toots from lcamtuf@infosec.exchange

Written by tekhedd on 2025-01-08 at 20:54

@lcamtuf The more I stare at this code, the more I think I actually hate you. I mean, in a good way, but still. 😉

=> More informations about this toot | More toots from tekhedd@byteheaven.net

Written by Amber (deilannist) on 2025-01-08 at 23:25

@lcamtuf@infosec.exchange there is only one gif that can describe my reaction to this.

=> View attached media

=> More informations about this toot | More toots from puppygirlhornypost2@transfem.social

Written by Mondanzo on 2025-01-15 at 17:04

@puppygirlhornypost2 @lcamtuf wait, this is intended to be confusing and worrisome? I thought this was originally a genuine approach to C programming ​:sobbing:​

=> More informations about this toot | More toots from mondanzo@wolfdo.gg

Written by Drahflow on 2025-01-08 at 22:09

@lcamtuf The second example is clear enough. But the first, uh, gcc's hand-crafted parser clowns the standard committee yet again.

💯 for "using" the function and avoiding the warning.

=> More informations about this toot | More toots from drahflow@infosec.exchange

Written by Jeroen Massar on 2025-01-08 at 21:20

@lcamtuf subtitle of your book "C for perl coders"? ;)

And as a bonus for the first 42 copies you get a little spray bottle of bleach to apply gently to your eyes? ;)

=> More informations about this toot | More toots from jeroen@secluded.ch

Written by vascorsd on 2025-01-08 at 21:57

@lcamtuf I have a feeling, a feeling that something is wrong, very wrong, around this area :thonking:

=> More informations about this toot | More toots from vascorsd@mastodon.social

Written by Gilgwath on 2025-01-08 at 22:49

@lcamtuf Can I get a printed version ... not sure whether I want to burn it or frame it. 😂

Reminds me of Scala workshop I attended. The instructur started with showing off how beautiful Scala code could be and without commenting on it at all, the code on his slides just got progressively more uggly until it reached a similar level of cursed. 😬

=> More informations about this toot | More toots from gilgwath@social.tchncs.de

Written by Rey :ghosthug: on 2025-01-09 at 00:32

@lcamtuf I THOUGHT I KNEW C, DAMMIT! o.O

=> More informations about this toot | More toots from nothe@notacult.social

Written by kauer on 2025-01-09 at 03:01

@lcamtuf surely your book is at least approximately rectangular?

=> More informations about this toot | More toots from kauer@aus.social

Written by Kallisti on 2025-01-09 at 06:34

@lcamtuf This is the type of shitpost one can only find on the fediverse

=> More informations about this toot | More toots from kallisti@infosec.exchange

Written by Dianora (Diane Bruce) on 2025-01-09 at 20:57

@lcamtuf C sucks.

=> More informations about this toot | More toots from Dianora@ottawa.place

Written by Eloy 🔜 FOSDEM on 2025-01-10 at 16:22

@lcamtuf TIL about zombo.com

=> More informations about this toot | More toots from eloy@hsnl.social

Written by leo vriska :light2: on 2025-01-10 at 17:54

@lcamtuf oh god i spent like 5 minutes trying to figure out where this syntax to override function symbols was defined before realizing it wasn't different from the "normal" syntax

=> More informations about this toot | More toots from leo@60228.dev

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113794502609277045
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
575.999577 milliseconds
Gemini-to-HTML Time
3.939974 milliseconds

This content has been proxied by September (3851b).