Dima
like static/fixed arrays?
BinaryByter
Anonymous
Anonymous
Nobody knows this in detail?*
Anonymous
Welcome JoHnY!
Please read the pinned message 🙂
Anonymous
G
Stefan
Stefan
and the compiler is called cfront
Anonymous
Instead of g++?
Stefan
yeah
Stefan
i asked bjrane himself for that...i think im quite stupid at the time
Stefan
Stefan
olli
think about what you just proposed for a second
Containers might be useful in `constexpr`contexts as well, but therefore you would need to have "dynamic memory at compile time"
IIRC this has been initially proposed in 2017
Anonymous
Stefan
Anonymous
buffer overflow from stdin
What can I search for or what can I do to learn the specifics on how it was remedied with scanf, and how to perform the buffer overflow?
Stefan
Stefan
while gets and getc
Stefan
Anonymous
Can I recover my deleted data from my laptop??????
klimi
klimi
Anonymous
If I write
const int a;
int *p =&a;
Is this wrong..?
Stefan
Stefan
But undefined behavior
Stefan
UB is right and wrong at the same time
Stefan
because this const modifier isn’t really constant
Stefan
It just tells the compiler that this variable shouldn’t be reassigned
Stefan
Aka immutable
Stefan
Using this information, the compiler can perform real constant propagation optimisation
Stefan
See the three shits of javascript: let const var
klimi
Hey dude, do you have permission?
klimi
I mean if you don't answer within 5 mins I'll delete that and warn you for not obeying rules
Ariana
/warn ad for a crappy event
Anonymous
that message has link different
Anonymous
yes we have the permission
Stefan
uh, no?
Stefan
https://godbolt.org/z/ss9hEc
Stefan
[Meme] Learning C, thought this little tidbit was hilarious
https://redd.it/anerd8
by @programmer_humor
klimi
Stefan
Stefan
But undefined behavior
Stefan
UB is right and wrong at the same time
Stefan
because this const modifier isn’t really constant
Stefan
so basically saying, ub is nondeterministic
Stefan
anything could happen, philosophical absurdity
Stefan
people used to call it nasal demon
Stefan
then why you could assign a mutable value into "const"
Stefan
char *foo = "bar"
this is actually undefined
Stefan
assigning a const char[4] to char*
Stefan
under pointer decay, const char[4] -> const char * -> char *
Stefan
immutable -> mutable
mutable -> immutable
Stefan
what is this, insanity?
Anonymous
Dima
/ban no
Stefan
alright, i will stop the flamewar here, actually this is ambiguous
Stefan
under c, ub
under c++, plain out compilation error
Stefan
we dont have an answer, pigs can fly
Stefan
would you mind using visual studio to check the type of the string literal, it will exactly show you const char[strlen(this) + 1]
Stefan
https://en.cppreference.com/w/cpp/language/string_literal
Stefan
you be getting a pointer, that's the consequence of array decaying
Stefan
well, you could see this as a terrific past of c++ trying to smoosh with c
Stefan
then isn't it contradictory? "constant"/immutable things can be made mutable
Stefan
why is this not?
Stefan
error: invalid conversion from 'const int*' to 'int*'
Stefan
sounds paradoxic to me
Ludovic 'Archivist'
Stefan
Ludovic 'Archivist'
Ludovic 'Archivist'
Just do you want a dragon in your server room?
Stefan
Ludovic 'Archivist'
Probably not
Ludovic 'Archivist'
And if you want a dragon, you want a tamed one
Ludovic 'Archivist'
One that you can put in a wheel to generate power