|
NPTEL seems to be great resource for online learning.
If you are not criticized, you may not be doing much.
|
|
|
|
|
Forget digresses! Either he knows what he it talking about or he does not. I've been telling computers what to do for over 30 years and do not have a degree. But then again, there was no degree's on the subject when I stated.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
I don't have a degree either, and it's one of the reasons I find the work above so valuable.
Real programmers use butterflies
|
|
|
|
|
When I saw a cmovne instruction in a disassembly through which I am tracing, I asked Bing what it was, and got the details at Purpose of cmove instruction in x86 assembly? - Stack Overflow, which are borne out by the demonstrated behavior of my code. It appears that the Visual C++ compiler that ships with Visual Studio 2019 counts the cost of two mov instructions followed by a cmovne instruction as less than that of a branch that causes both to execute anyway, even though the outcome of one of the two mov instructions would eventually be discarded.
Moreover, this is happening in a debug build!
This is by no means the first such unexpected optimization that I've seen the MSVC compiler generate in a debug build.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
David A. Gray wrote: It appears that the Visual C++ compiler that ships with Visual Studio 2019 counts the cost of two mov instructions followed by a cmovne instruction as less than that of a branch that causes both
Keep in mind that due to the speculative execution leaks... the emitted instructions may be avoiding data-dependent branching. Optimization is not as simple as it was ten years ago...
Do me a favor and right click on your project settings and navigate to the 'Code Generation' tab and check if /Qspectre is enabled.
|
|
|
|
|
My take on the whole point of the conditional move instruction is to eliminate speculative execution from the mix by keeping the program flow in a straight line. FWIW, I double-checked, and Spectre mitigation is disabled. I suspected it was, because I've never enabled it for any of my projects.
What made it stand out was that this was happening in a debug build. Had it been a release build, I would have expected this level of optimization. However, this is the most recent of many such unanticipated, and welcome, optimizations, that I've seen in recent debug builds.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
David A. Gray wrote: What made it stand out was that this was happening in a debug build. Had it been a release build, I would have expected this level of optimization. However, this is the most recent of many such unanticipated, and welcome, optimizations, that I've seen in recent debug builds. Yeah, it's not a coincidence that the first compiler implementing the /Qspectre mitigations[^] is generating slighty different conditional moves. It's an active area of development.
Best Wishes,
-David Delaune
|
|
|
|
|
I just pasted a block of #define directives from the application header of a C++ program that I am writing in preparation for writing a short article for the Actian developer blog. When I applied the Trim worksheet function to a substring that contains a hexadecimal value that I wanted in its own column, I noticed that the cell had a leading space. Since it obviously wasn't a SPACE or a TAB, I turned on the hexadecimal view mode in my editor (UltraEdit), and discovered that the hexadecimal code of the character at that location was 0xA0, 160 decimal, the nonbreaking space character.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
I always use invisible whitespace in my comment and human strings, don't you?!
Everyone loves them!
|
|
|
|
|
David A. Gray wrote: I just pasted a block of #define directives [sic] from the application header of a C++ program that I am writing... He that lieth down with dogs shall rise up with fleas. --Poor Richard's Almanack
|
|
|
|
|
I typically do not like javascript. It's not personal, it's just the language's typing system I've always found difficult to use, and overall i find the language hard to debug.
But I've been wanting to find information on LL(k) parse table generation that I could digest for years, and some good folx produced an implementation in javascript which doesn't seem to use anything too weird or JS specific so I'm porting it to C#.
Sure I have to debug it in chrome to fill in some of the details but they made it easy to port, and I imagine they planned it that way.
What's fascinating to me about it too, is they're using a parser and lexer to parse the input grammar that looks like it was generated using a port of some common C based tools to javascript.
what a weird and cool little program.
LL(k) Parsing Table Generator[^]
Real programmers use butterflies
|
|
|
|
|
It's not too difficult the other way round too - I just converted a steganography application from C# to Javascript.
I tend to use React and Typescript because with Typescript you can avoid a lot of the problems vanilla Javascript can lead you into.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Yeah I converted a splay tree from typescript to C# once to learn how it was done, and it was a joy.
I didn't end up using the implementation, because it was recursive, but it taught me the concepts.
Real programmers use butterflies
|
|
|
|
|
C++ error messages are often incomprehensibly surreal. I was baffled by an "Undefined reference to vtable" message until a tedious investigation revealed it was just a missing method from my class. Why the f doesn't the C++ compiler just say: "Method xxx is missing."??
This is just a sample; there are many more C++ error messages from simple causes complaining about parts of the compiler I've never even HEARD of. Out of curiosity, I emailed Bjarne Stroustrup and asked him why C++ error messages were so incomprehensible. Here is his reply:
"Thank you for your inquiry. Goats are like mushrooms. If you shoot a duck, I'm scared of toasters."
I guess that answers my question.
|
|
|
|
|
They can be utterly incomprehensible but you get used to them. I revisited C then C++ recently after several years away with C# and found the messages from the compiler to be almost universally unhelpful but after a week or so I settled into it again.
|
|
|
|
|
big same
Real programmers use butterflies
|
|
|
|
|
What compiler are you using? I find Microsoft's to be reasonable most of the time, though errors when using templates can be voluminous and hard to decipher (not a problem specific to Microsoft). I'm surprised that the vtable error wasn't a linker error about a missing function. It's actually better that they detected this at compile time, but I agree that the error message is crap.
|
|
|
|
|
In my own observation, C++ is still governed by idealists more than pragmatists and to a idealist, doing anything with the truth except displaying it in an unfiltered manner is wrong.
Specifically about error messages, https://blog.regehr.org/archives/1088 is an interesting read
|
|
|
|
|
I disagree. Compiler writers aren't idealists, they're all failed stand-up comedians. They can't resist being cute .
Software Zen: delete this;
|
|
|
|
|
That's called hitting the nail on the head!
|
|
|
|
|
I think C++ error messages give you the most information possible about the error. The problem is, they use the language of the C++ standard's meta-syntactic categories to describe what the compiler was doing when it stopped being able to parse your input. If you're not super familiar with the feature you're using, you probably don't know its meta-syntax all that well, so you find the error message incomprehensible. A quick trip to cplusplus.com or cppreference.com will set you right.
|
|
|
|
|
Using these meta-categories violates the abstraction provided by the C++ language. It's lazy programming by the writers of the compiler. No other language (that I know of) does this.
|
|
|
|
|
Well, I don't think it's unreasonable to use published-in-the-standard meta-syntactic categories, though I agree the error messages could have been clearer. What C++ compiler are you primarily working with?
And (some) compilers have referred to meta-syntactic categories for as long as there have been compilers. You may have just gotten lucky. It's a very natural thing to do if you're a compiler writer, though as I said, the error messages could sometimes be more clearly phrased without reference to the meta-syntax.
|
|
|
|
|
It's g++ 7.4.0 (Ubuntu 18.04). Compilers present an abstraction of the machine to the user. Making the user deal with implementation details is a violation of this abstraction. You'd never see anything like this in C#.
|
|
|
|
|
I think my favourite one was a Cobol compiler message from a Prime minicomputer back in the '80s - which said, "Error 23, line 72, column 21, severity 3: fatal. Either an IF is missing or an ELSE is missing or a THEN is missing or the compiler is broken."
By "broken" I think it meant someone pressed Break, but still...
|
|
|
|