Main is usually a function. So then when is it not?

OP (Firma: RUB) #5139907
Lesenswert?

Ich finde es immer wieder interessant, auf was fuer Ideen Menschen so 
kommen :)

Main is usually a function. So then when is it not?
http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html
1
It began when my coworker, despite already knowing how to program,
2
was forced to take the intro level Computer Science course at my
3
university. We joked with him about how he needs to make a program
4
that works, but the grading TAs wouldn’t be able to figure out how
5
it works. So that is the requirement, to make a functioning program
6
that completes an assignment while obfuscating it such that the
7
graders think that it shouldn’t work.
8

9
[...]
Gast #5139941
Lesenswert?

Interessante Idee, aber  ... was sagt der Standard dazu?
1
The behavior is undefined in the following circumstances:
2
...
3
-A program in a hosted environment does not define a function named main using one of the specified forms (5.1.2.2.1).
4
...
Es ist also nicht nur abhängig von der konkreten CPU, es ist auch klar 
UB.
1
"I’m guessing all that will happen when my coworker turns in an assignment looking like this is they will take off points for bad coding style and say nothing else about it."
Oder es gibt 0 Punkte, weil das Program nicht funktioniert.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren