T
T
Tom Nolane2017-02-26 12:33:08
C++ / C#
Tom Nolane, 2017-02-26 12:33:08

What does the phrase "shoot yourself in the foot" mean? (as code)?

Often I hear / read this statement, and most often this expression comes across in articles / comments (especially when mentioning the C and C ++ languages).
I don't know. (a little more difficult than "Hello world") I know C++ (I'm quite good at C#)... As I understand it... it's something like "cut the branch you're sitting on"... but how does it look like in an example (in With ++ for example) in the code???
ps are interested in the most "typical" cases)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nirvimel, 2017-02-26
@tomnolane

*((int *) 0) = 1;
No other language does this so easily.

S
Saboteur, 2017-02-26
@saboteur_kiev

This means that it is possible to write a command or construct in the language that will break the normal behavior of a program or system (or will be executed in a completely different way than one could logically assume), and at the same time the compiler / interpreter will compile this and not swear.
Read here:
lurkmore.to/%D0%92%D1%8B%D1%81%D1%82%D1%80%D0%B5%D...

B
BBmike, 2017-02-26
@BBmike

The YaP is compared here with a 19th century revolver, which did not have an automatic cocking and either the shooter is slow and lifeless, or he walks with the cocked trigger and shoots himself off in the foot.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question