Re:The Following Code Causes Segfault in Clang
by andrewchambers on Saturday August 02, 2014 @06:21PM
(#8126270)
Something tells me C++ isn't the best thing to implement a compiler with.
[ Parent
| on HN ]
Re:The Following Code Causes Segfault in Clang
by millstone on Saturday August 02, 2014 @08:01PM
(#8126503)
This looks to be an assertion failure, i.e. code that was thought to be unreachable is not. So there's no evidence that any of the negatives of C++ (memory safety, etc.) are in play here.
Re:The Following Code Causes Segfault in Clang
by andrewchambers on Saturday August 02, 2014 @09:58PM
(#8126752)
If that's the case I was being too harsh on clang.
Re:The Following Code Causes Segfault in Clang
by andrewchambers on Saturday August 02, 2014 @10:12PM
(#8126782)
I guess I was being to harsh on the memory issues in C++.
In practice it is a non issue, because build scripts can run arbitrary code long before a memory corruption in the system compiler. And if you plan on running the code you just compiled, you must already trust the code.
Unless of course its a segfault in LLVM and not just clang. LLVM is used for JIT in web browsers now, not that there are really any suitable replacements for C++ right now.
Re:The Following Code Causes Segfault in Clang
by golemotron on Saturday August 02, 2014 @08:05PM
(#8126518)
I modded you up because clang is written in C++ and even if I didn't know this I'd suspect it because segfaults in languages that are not weakly typed (i.e., C and C++) are incredibly rare.
There are better languages to write compilers in. OCaml is one.
Re:The Following Code Causes Segfault in Clang
by timshen on Saturday August 02, 2014 @09:52PM
(#8126736)
I'd rather say that C++ "fixes" C's unsafe type system by making some of the castings legal, instead of safer :)
Re:The Following Code Causes Segfault in Clang
by nly on Saturday August 02, 2014 @09:07PM
(#8126643)
C++ probably isn't 'weakly typed', whatever that means.
Re:The Following Code Causes Segfault in Clang
by yzzxy on Saturday August 02, 2014 @09:20PM
(#8126672)
You probably aren't "qualified to make that statement", if you don't know what weak typing is and are too lazy to google it.
https://en.wikipedia.org/wiki/Strong_and_weak_typing
> In general, these terms do not have a precise definition. Rather, they tend to be used by advocates or critics of a given programming language, as a means of explaining why a given language is better or worse than alternatives.
Re:The Following Code Causes Segfault in Clang
by mateo411 on Saturday August 02, 2014 @10:34PM
(#8126832)
C is weakly typed, because you can cast or set any variable to be a void *. Since C is weakly typed, then you can write a C++ program that is also weakly typed.
Re:The Following Code Causes Segfault in Clang
by Tloewald on Saturday August 02, 2014 @07:43PM
(#8126456)
FYI: someone has modded you down because the compiler is crashing when it compiles the C++ code, not because it is written in any particular language.
Re:The Following Code Causes Segfault in Clang
by andrewchambers on Saturday August 02, 2014 @10:17PM
(#8126793)
I'm aware, I care because LLVM is being integrated in web browsers as part of the JIT engine, and clang uses LLVM as its backend. So any segfaults related to LLVM (though not this one in particular) make me worried about browser security.
Re:The Following Code Causes Segfault in Clang
by darkpore on Sunday August 03, 2014 @05:32AM
(#8127510)
lol - you're aware that most web browsers are written in C++?
Re:The Following Code Causes Segfault in Clang
by andrewchambers on Sunday August 03, 2014 @07:30AM
(#8127655)
Painfully aware.
You do understand what an ever increasing attack surface does?