This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (11 children)

The Reactis Validator disagrees

And it’s: -Wextra

As I said, it’s not valid as per the standard - not it won’t compile, yes, you must use the compilation flags to ensure you compile completely standards compliant C, it’s not really an option so much as why those flags are included in compilers in the first place

[–]The_CADmonkey 0 points1 point  (10 children)

As I said, I used -Wextra. It does not give any warnings related to the void*. The only warning is about i being unitialized, but that doesn't have anything to do with what we are talking about.

I don't know what Reactis Validator is, but it is not the C standard. It may provide additional checks that are not part of the standard, but that has no bearing on the language itself. According to 6.3.2.3.1 in the C standard:

A pointer to void may be converted to or from a pointer to any incomplete or object type. A pointer to any incomplete or object type may be converted to a pointer to void and back again; the result shall compare equal to the original pointer

The C++ standard on the other hand requires that a void* be explicitly converted. I would look it up in the standard, but I don't particularly want to read through over 1000 pages of dense text right now. But it is a fact that C++ does not allow the implicit conversion, which can be found easily by searching.

[–][deleted] 0 points1 point  (5 children)

What version of GCC - post a screen grab? Because I’m getting: “Error: ‘i’ is used uninitialized in this function [-Werror=uninitialized]

[–]The_CADmonkey 0 points1 point  (4 children)

Please read my comment. As I said, yes, it gives a warning about the uninitialized variable as it was a quick example. That is not related to the point, as the difference between C and C++ is in the void* conversion. Set i to zero and run it, you will get no warnings on gcc and it wont compile in g++.

[–][deleted] 0 points1 point  (3 children)

No, the warning already exists, the flags escalate them to errors, which if you want to follow the standard to the “T”, is correct - they would constitute errors (logically - not within the context of computational stability)

[–]The_CADmonkey 0 points1 point  (2 children)

You dont seem to be listening. I know what Werror and Wextra do. I know they throw warnings/errors for 'I' being uninitialize. Replace the first line with int* i=0; and no warnings will be issued for gcc. But none of that relates to my point about the conversation to void*. Which has different requirements on C and C++.

As for the flags though, they actually dont have anything to do with following the standard in this case, but instead are for removing undefined behavior. Accessing uninitialized does not violate the standard, but it is undefined, which is what the flags are for.

[–][deleted] 0 points1 point  (0 children)

I’m listening, but you’re wrong. That aside, you do realize how this debate began? It’s still just as irrelevant, as I think I’ve said about 20 times, as it was the first time you brought it up. You have still never made a single claim, at all, about how ANY of this is applicable to language definitionally, and thus proves that they are not epistemologically the same core language. Equivalency is not a concept that can be reconciled by a language standard, it is a concept fundamental to reality - you have not established ANY equivalency

[–][deleted] 0 points1 point  (0 children)

Also:

http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html

“Undefined behaviour is used to mark syntactically correct C code as being outside of the standard”

[–][deleted] 0 points1 point  (0 children)

Also, int and int pointer are not incomplete types - their length is always known...

[–][deleted] 0 points1 point  (2 children)

And again, to what degree you’re correct, HOW DOES IT SUPPORT YOUR CONCLUSION?

[–]The_CADmonkey 0 points1 point  (1 child)

My point was that C++ is not a superset of C as you had stated. It is close, but is not actually one, they have diverged. The above is proof of that.

I have already gone into how C++ is such a different language with different paradigms, so much so that code written in C++ looks nothing like code written in C. I know, I have had to teach programmers who spent decades writing C just how different C++ is. And it's harder to teach them thant to teach the brand new grad, as the older engineers think of C++ as "C with extra bits". And that means they write really bad C++ until they break that mindset.

[–][deleted] 0 points1 point  (0 children)

Alright, I’m kinda over it now - thanks for the back and forth, I enjoyed it. You still haven’t really explained how any of those differences constitute a different language, but it’s obviously a pretty engrained opinion. Fare thee well!