#Low-Level Programming Day 1

1 messages · Page 1 of 1 (latest)

wild kayak
#

I know C is really outdated, and it has security vulnerabliities if you encounter undefined behaviour by accident
L opinion

#

or well

#

just don't cause UB

#

here is a hint: -fsanitize=undefined to gcc
it helps catch runtime UB

steady juniper
wild kayak
#

also -Wall -Wextra can help at compile-time

#

gl on your journey

steady juniper
#

Thanks.

wild kayak
#

which I have found to be helpful

rocky valley
#

C is perfectly adequate

rocky valley
#

you can write vulnerabilities in any language

steady juniper
#

Agree

sharp sandal
#

wants to learn programming
being a based god, chooses c
being even more based, chooses this book
well, you're starting out better than i did,

#

make sure to pass -std=c89 and -pedantic to your compiler as well

#

or you might get weird warnings since the code in the book is... well, ansi c and the compiler doesn't know that

sinful jay
#

to add to those opinions, you should always use -Wpedantic -Wall -Wextra -Werror locally, that part on -std=... makes sense due to the book using dated things, sanitizers offer additional runtime checks, which are not totally bulletproof, but useful, so you may want to run your programs after compiling them with e.g. -fsanitize=address,undefined, those all things together will help you catch a lots of problems

sharp sandal
#

thanks for aggregating the suggestions :)

sinful jay
#

the code on the screenshot has a problem that should be pointed out by compiler with warnings enabled

sharp sandal
#

which one

#

where's the screenshot 😭

#

am i stupid

sinful jay
#

at the beginning of the thread

sharp sandal
#

oh lemme scroll up

sinful jay
#

the very first message

sharp sandal
#

oh

#

yeah you forgot to return in main

sinful jay
#

no, that's not it

sharp sandal
#

oop

#

what is it

#

idk? the declaration of celsius twice?

sinful jay
#

(I mean if you assumed it is C89 then it would be a problem, the missing return, but then the other problem is also there, but completely different than in later C)

sinful jay
sharp sandal
#

pheww

sinful jay
#

in C89 you cannot declare in for, in later you leave unused variable

#

and that will be noticed

sharp sandal
#

i thought there was a \m at first because of crappy windows font rendering

sharp sandal
#

anyways op if you want to do something really fun make a random passphrase generator

#

load up an english dictionary wordlist

#

randomly pick one word

#

rinse and repeat until you have enough words in the passphrase