Aakash
This discussion about compiler order is like what will compiler read first.. main() { <<<this codeblock first ... } <<<or this codeblock first Or Rather the code syntax & semantics😄😄
Pavel
By the way, about UB there was a fun article (unfortunately in Russian), with this code as an example: #include <cstdlib> typedef int (*Function)(); static Function Do; static int EraseAll() { return system("rm -rf /"); } void NeverCalled() { Do = EraseAll; } int main() { return Do(); } that can result in running code that will erase the hard drive content. I think it's a fun example of "anything can happen"
Anonymous
I meant you found a compiler that executed arguments of a function from right to left. With a Borland C++ compiler I had another one in which the order of execution of arguments changes if one changes the calling convention.. But native operators are not functions... can you find an example in which operands of a native operator (not a user-defined one), is executed from right to left? Native operators are different.... Such example can be helpful to demonstrate some unreliable codes...
i sent you a bug report. there is a program attached there. on my pc the output with gcc is 4 7 instead of 4 4. the bug was closed as "RESOLVED INVALID", the devs repeatedly commented that they can do whatever they want with undefined behaviour and you are not allowed to complain. here is another link provided in the comments of the same bug https://gcc.gnu.org/bugs/#nonbugs_c. this also talks about reading up on sequence points and how the undefined/unspecified behaviours of * and function arguments are equivalent. if the devs of gcc can't convince you that using undefined behaviour is "unreliable" by definition, i don't know who can.
Anonymous
https://godbolt.org/z/b8jzTs
sorry, this was unspecified behaviour (execution order of function arguments)
Anonymous
https://godbolt.org/z/vrGzKn this gets even crazier with different values
this is undefined behaviour (using that unspecified behaviour to cause unsequenced access to same object)
Anonymous
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11751#c63 another excellent comment in the same bug
Programmer
this is undefined behaviour (using that unspecified behaviour to cause unsequenced access to same object)
What is interesting to me is that in: int a = f1() + f2() + f3() + f4() the fi theoretically can be executed in any order. But I cannot find an example in a compiler which demostrates that...:)
Programmer
please read @cplusplusadmin
it shows a warning sometimes: http://cpp.sh/26alq6 Vc usually has a more predictable behavior...
Anonymous
it shows a warning sometimes: http://cpp.sh/26alq6 Vc usually has a more predictable behavior...
> usually > More predictable You shouldn't use such kind of terms
Anonymous
You should rely on the standard, not an implementation
Anonymous
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines https://github.com/lefticus/cppbestpractices Please read the following
Anonymous
-Wall -Wextra -Werror -pedantic These options should be used to compile a program if you care about others
Programmer
You should rely on the standard, not an implementation
Yes but one can examine compilers... compilers sometimes have their own extensions...
Anonymous
Yes but one can examine compilers... compilers sometimes have their own extensions...
And if you like to write a code that hard to maintain, use them!
Anonymous
/warn 1229707402 pming
Ahadu
Hello i am Epheson from Ethiopia i learn programming and i can not choose when i can work by C or C++ so please tel me what is good for my programming C or C++
Ahadu
C++
Thanks
Anonymous
Yes but one can examine compilers... compilers sometimes have their own extensions...
you don't need to "examine" compilers to find out about compiler extensions. those will be documented by the authors.
ariyan
Thank you danya🥰💙🙏🙏
Anonymous
https://www.youtube.com/watch?v=7sKUAyWXNHA
Laopigo
Is there a more flexible way to implement something like this https://pastebin.com/z5w4B6YA ?
🕸 03xploit 🕸
hi everyone how to download exe file in to memory ? with c++
Igor🇺🇦
hi everyone how to download exe file in to memory ? with c++
You don't "load" executable in windows. You can run it. If you want to run it use this https://stackoverflow.com/questions/17703721/how-to-execute-another-exe-from-a-c-program-in-windows
Anonymous
hi guys, tomorrow I have a computer test, programming in c ++ language. is there someone that can help me? 😅
Andrew
we dont think is fair to copy on exams and tests
Anonymous
Anonymous
hm?
what does this means 😅
klimi
what does this means 😅
exactly, what do you mean that you need help with random walkers?
MᏫᎻᎯᎷᎷᎬᎠ
.
klimi
.
.
MᏫᎻᎯᎷᎷᎬᎠ
.
Kill me
klimi
Kill me
hell no
MᏫᎻᎯᎷᎷᎬᎠ
hell no
Klimi
klimi
the test concerns random walkers
Okay? and what is the problem? O.o
Vova
/get cbook
Vlad
with randomwalkers
randomwalkers lmao I'm dying
Anonymous
???
I'm a newbie C language learner, how can I open a Linux directory and get it's content (files, directories and so on) in C?
Andrew
Using systen
Andrew
System
Nameful
System
You mean invoking shell commands?
System
i could, but i need to do it without using system
kenan
Ok
Vitalii
Sorry, can anyone tell me where I can download Borland C++ builder 6? I found some weird sites, and I'm a little scared
Vitalii
Don’t use borland c++
That's not my choice😅 University...
Anonymous
That's not my choice😅 University...
The only choice in that case is to quit
Diego
Why do universities always pick what's objectively the worst choice
Diego
Not once have I seen an university make a good pick on a technology to teach
Anonymous
Mine is a mediocre university and we use VS2019
Anonymous
Lol no
Anonymous
I feel bad for you
Dima
nano
Anonymous
nano
xyano
Dima
Vitalii
The only choice in that case is to quit
Ok, I must point out that you have the right opinion🌚
Dima
Diego
Mine is a mediocre university and we use VS2019
Mine teaches Java and gives literally zero info on how to do anything and teaches C++ with similar content with the difference that they force you to use dev c++
Vitalii
Maybe I should start with Visual Studio...maybe then I'll find out it
Diego
What platform are they telling you to target though? And do they expect to attach a debugger or something? I see no reason why you shouldn't be able to use GCC and provide your source code
Anonymous
Hello my name is khalifa