klimi
Just checking permissions
We should check for brain
Mihail
yes and no
In this case a yes
BinaryByter
yes and no
they don't cost anything since they are evaluated at compile time
BinaryByter
however, it is never wrong to adhere to good practices
BinaryByter
In this case a yes
imagine you put a line above the scanf and don't realize that the variable isn't initialized?
Rahul
Good practices makes better progammer
BinaryByter
UB
Mihail
they don't cost anything since they are evaluated at compile time
They do have the cost of your variable declarations looking like utter trash
Rahul
Assigning takes constant time
Rahul
Of operation
Rahul
Completely
Mihail
It's compile time evaluated here
Rahul
Yes its compile time
Mihail
So it won't even do the initialization
Rahul
Why you said not using
Rahul
Okay I understand the scanf replaced
Rahul
It but is good practices . With good practices code will be better handled
BinaryByter
its just that it might save time later down the line
klimi
Mihail Is admin uwu
Rahul
Yes
BinaryByter
in this case, you cannot say that either position is right
BinaryByter
saying that you ABSOLUTELY add the =0 is wrong
BinaryByter
but saying that adding it is bad, is also wrong
BinaryByter
both have a purpose
BinaryByter
and you need to know what you want
Mihail
Just checked
Mihail
gcc even with -O3 does the assignment
BinaryByter
gcc even with -O3 does the assignment
i doubt that it does that
BinaryByter
gcc instead would generate a bytecode file where the position of the variable contains the 0
BinaryByter
Did
show me 🤔
Mihail
One sec lemme figure out how to take a screenshot
Rahul
C1x
BinaryByter
xD
Rahul
C99 c89
Mihail
xD
https://godbolt.org/z/oLWvlT
Mihail
didn't know you could share
Mihail
that's convinient
klimi
Klimi is tired
BinaryByter
klimi will go to sleep now
BinaryByter
ok
klimi
ok
:'(
klimi
Be more persistent
BinaryByter
xD
BinaryByter
enjoy
Mihail
wat?
Wdym?
BinaryByter
why the fuck can't gcc find a good way to optimize this out?
BinaryByter
i had expected it to compile to something like this: int = 0; int *a = &;
klimi
enjoy
Noooooo
Mihail
Everyone send file . Is your bot scans the file . What if the device is hacked you are responsible
read the rules. i literally told you to stop with pointless discussions
Rahul
Okay great
BinaryByter
I'm sorry :(
BinaryByter
why did I?
Dima
Mihail
wat?
clang seems to be the same too
Rahul
gcc even with -O3 does the assignment
Which version of c standard it using . The issue is persistent with the old standards
Mihail
also that's irrelevant here
Mihail
standard doesn't tell the compiler how to optimize the code
Rahul
Really
Rahul
Standards define compiler is modifed based on standards
Rahul
C++14 means compiler is complaint with the standards or not
Rahul
Just instance
BinaryByter
the standard doesnt define how the compiler will optimize that specific statement
Rahul
So you think if the compile the code with full optimization in old compiler will give the same ans
BinaryByter
not nessecarily
BinaryByter
but not because of the standard