« first day (2414 days earlier)    last day (14 days later) » 

03:10
@DanielH: Read the tag-wiki. Without a version, questions are about standard C. Which is currently only the 2011 revision. Also C99 already disallowed implicit int. A simple search for "implicit int" in the standard will point you at this. Using at least a 18 year old version should not be a problem for a beginner. If not, the tag-wiki also is clear about enabling warnings.
@Olaf The C99 rationale (yes, I know it's non-normative) say "After issuing the diagnostic, an implementation may choose to assume an implicit declaration and continue translation in order to support existing programs that exploited this feature.". Most implementations do just that. This a question about a common, explicitly-endorsed compiler extension at worst; the code is still primarily C. Besides, that's tangential. The actual question would be exactly the same if the OP had explicitly typed extern int printf(char*, ...);.
@DanielH: Again: read the standard, start with the forword, it could hardly be more clear! Allowing to continue does not make this legal. Check where the standard requires an implementation to stop after any diagnostic message.
@DanielH: This is not a compiler extension, but an outdated, non compliant compiler and something which will be dumped by every responsible C developer. If someone still writes C code without preceeding declaration, he should better consider a different job, this is recommended practice since 28 years now (C89, aka ANSI-C). Oh, and I'm pretty sure even MSVC can generate a warning at least. If not: one more reason not to use it.
@Olaf Calm down. The question isn't whether the code is legal or not; there's no question that it's not. If the question isn't interesting to you, that's fine, you don't have to answer it, and you've already put the question on hold, so why don't you go find some questions that are interesting to you to answer, and drop the stern but pointless lectures?
03:30
@Olaf In n1570: Footnote 9 (non-normative) says that a compiler "may also successfully translate an invalid program". The (normative, but containing "should"s) paragraphs 6.4.4.2p6 and F.8.2p2 recommend proceeding with translation after issuing a diagnostics (for different issues). I saw no indication that it requires an implementation to stop after any diagnostic message.
@DanielH 1) "Non normative" 2) That's exactly what I wrote. 3) That does not make an invalid program magically valid. 4) 6.4.4.2p6 is about floating point constants. How is that in any way related? You can't just pick something from the text. And Annex F is about IEC60559 (aka IEEE754) floating point arithmetic. Not only does the standard not require this beahviour, but this is also completely unrelated.
5) I already wrote there is no such requirement. I already wrote that. How does all this contradict what I wrote? It still does not make this compliant C code.
@Olaf I thought you meant that the standard said you were required to stop after any diagnostic, which is why I went looking for that just in case it was true. It turns out we agree: the compiler is perfectly allowed to continue after a diagnostic.
@Olaf In which case, the fact that MSVC did continue does not make it non-conforming. Yes, I'm sure it is, but not in a way relevant to this question.
@DanielH Ah! "Allowing to continue does not make this legal." "this" refers to not having a declaration before usage.
@Olaf And, as I said before, this isn't relevant to the question anyway, because the translation unit would be valid with one extra line even though the same diagnostic would be generated.
@DanielH It is not the fact that it continues which makes the code non-conforming, but the fact that the code is non-conforming. Simplified, the compiler is free to do anything it wants; it is beyond the standard. (which might be the reason for the notorious problems with a certain OS)
@DanielH The standard does not cover "would be" either. Try arguing with your boss: "Well, if the files would have been read-only, I would not not have been able to delete them."
03:44
@Olaf Yes, the compiler is free to do whatever it wants. This isn't Windows- or Microsoft-specific; GCC only warns for this as well. The standard does not cover "would be", but human intelligence does; nobody has ever asked a question completely perfectly, and unlike a compiler, humans are smart enough to try to understand what was meant.
@DanielH sigh Please read about formal logic. That's an induction. From false anything can follow!
And no, a compliant compiler is not "free to do anything it wants". It has to emit a diagnostic. It is the user who can do "anything he wants". Just not if he is in a project of mine (or all professional developers I know) and wants to keep his job.
@Olaf "If...would" is causal implication, not material implication. "If you add this line, the compiler will not issue the warning but will still issue the error" is a true causal statement; "if you add this line, the compiler will bake you a birthday cake" is a false causal statement even though "if this line is present, the compiler is baking you a birthday cake" is a true material statement.
The question was absolutely pointless and just shows a major missunderstanding of programming basics, not even C..
@DanielH sigh sigh sigh It was not about the statement of mine, but about what happens in the compiler. Anyway, I'll leave it at this.
The question was about understanding why the linker generated an error. Yes, it generated an error because he did something invalid. That doesn't explain why the invalid thing generated the error, and you aren't even talking about the issue that caused the problem.
The invalid thing generated a diagnostic. Yay, the compiler did its job. And then it did something unexpected after that. It was allowed to do the unexpected thing, but that doesn't say why it did. If your boss asks you why you stole some office equipment, saying "Well, I did all the tasks I was assigned" really doesn't answer the question.
@DanielH Which was not answerable without additional information. Hence there were two "no mcve" CVs, too. In fact, I rolled dice. And yet, despite the comment from another user, I was one of five who closed the question. Maybe you continue with the other users.
03:55
That's a perfectly valid reason to put the question on hold. "It is pointless" is not, when several people in the comments (not just myself) see the point is learning how the compiler works. Breaking things is a common and useful means of learning, practiced long before putting them back together was as easy as git reset.
 
3 hours later…
06:45
Look, 5 years ago what i did worked perfectly! the question is what changed? when you look at the asm code generated from my code, you can easily see the exact same CALL command! the linker doesn't care that I didn't declare the function, he cares about a valid obj file. from what I understand, when the linker sees a reference to a function he needs to link the related function, doesn't he? and the reference is absolutly fine, and the linker can get the function from the libraries.
@Olaf I don't understand whats so bad about my question? I don't recommend to remove the declarations, I just want to learn about the linker's job. if you don't interested you don't have to stay here.. I wound be more then happy if the question opens. Because maybe more people would be able to answer my question, i think that its clear enough now, i even added a video which explains my point
 
1 hour later…

« first day (2414 days earlier)    last day (14 days later) »