|
I concur with him except for a few things that would need alternatives. See the last section of the article linked in my .sig.
Edit: This refers to the preprocessor, not modules, which I still need to look at to form an opinion as to whether they're useful or just more pedantic bloat.
|
|
|
|
|
It talks about the advantages of modules but doesn't actually show how they're used. It just criticizes the status quo, which begs the question.
All it says it that modules have far less overhead than headers, that you don't need separate .h's and .cpp's, and that you define what to export. Wonderful, more boilerplate that adds nothing to functionality. It's probably a PITA to convert existing code but does sound like a plus if used from the start.
|
|
|
|
|
if it means not having to recompile the contents of large header flles that are widely #included ed a bazillion times, I'd expect a bigger win than the size of the object files he's griping about would be the speedup in compilation times on larger projects. When you're working on a big project that takes 20 or 30 minutes (or worse) to compile shaving time off the build process seems like a win that'd be worth a lot of time for someone to update the existing code base.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
I would assume, perhaps mistakenly, that a decent compiler would compile a header file once and reuse the result when compiling other translation units.
My static analysis tool compiles everything in a single pass after analyzing #include directives. None of this translation unit nonsense. I think this would almost be possible for a true compiler, the preprocessor (which I use sparingly) being the primary exception. But I've got a feeling that I must be overlooking something...
|
|
|
|
|
I could be mistaken - I'm definitely not a compiler expert - but I'm pretty sure I read that churning through headers is a big hit for C++ compilation; and that it was a mess due to back compatibility with C which was optimized to fit in the tiny amount of ram on the old low end PDP it was originally developed for not for compilation efficiency and that it ended up stuck with significant tech debt as a result.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
‘Doom’ truly is eternal. I wonder if it runs... oh. Nevermind.
|
|
|
|
|
Kent Sharkey wrote: I wonder if it runs... oh. Nevermind. Sick. Imagine running W95 on a Doom-chip.
Worse. If that's possible, you can run SimCity in Doom.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
The proof that a Doom chip is equivalent to a Turing machine is left to a graduate Computer Science student with way too much time on his* hands.
*No woman would waste time that way...
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Microsoft and Intel Labs work on STAMINA, a new deep learning approach for detecting and classifying malware. Do you see that cloud up there that looks like a phishing attack?
|
|
|
|
|
Kent Sharkey wrote: Do you see that cloud up there that looks like a phishing attack? Which one? The one of Amazon or Google or Microsoft...?
A sorry... you said phising, I thought it was privacy
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Did you say "into images" or "into icons"?
|
|
|
|
|
Could I reverse the process....
Photoshopping an image to look like malware, and then compile the bytes?
Will CoVid-19 run on Windows?
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
Attackers who gain physical access to Windows, Linux, or macOS devices can access and steal data from their hard drives by exploiting 7 vulnerabilities found in Intel's Thunderbolt hardware interface and collectively known as Thunderspy. Between this and the lightning cables - very, very frightening me!
"All the attacker needs is 5 minutes alone with the computer, a screwdriver, and some easily portable hardware."
Yup, another: "If they can do this to your machine, odds are they could get the data through other means." kind of security issue. Still, works on locked machines, so not good. Buy a new computer
|
|
|
|
|
Kent Sharkey wrote: Buy a new computer
Better yet, get rid of all your electronics and become a monk. The only secure code is no code! The way of the Tao.
|
|
|
|
|
Kent Sharkey wrote: very, very frightening me! Galileoooo, galileooo, Galileoooo, galileooo, Galileoooo Figaroooo
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Beelzebub has a devil for a sideboard.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
C# is a very flexible language, allowing you to write clean and functional code, but also very bloated code. Readability is overrated?
|
|
|
|
|
When I look at that web page, I find myself thinking "wow, that page could REALLY BENEFIT FROM HAVING A SCROLLBAR"!
|
|
|
|
|
Kent Sharkey wrote: Readability is overrated? Obviously. The shorter you can write some code, the smarter you are.
That guy complaining that reading it takes too long just proves his incompetence.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
|
I never understood how putting braces on a separate line "improves readability". Imagine a fiction text, a short story or novel, where each comma, semicolon or full stop is put on a line by itself: Would that improve readability?
To me: Certainly not. 30-40 years ago, technical documentation was ridden by a wave of "Structured writing": Everything should be a bullet point, a paragraph, a chapter in an n-level structure (with no limit on n - I saw one manual of thirteen chapter levels!), or whatever. Anything but "unstructured text" - a two-paragraph sentence was a sign of missing structure. The structure was the essential thing. I had a feeling that contents was somewhere between inessential and absent. Fortunately, the most extreme "structured writing" ideas faded away.
If a programmer does not have the mental capacity to process both a premise and a conclusion as a whole, as one unit, but demand a format that says, e.g.
- We are deviating from a linear sequence of actions: This is a break of flow, so we will prepare you for it by adding a blank line before this break.
- We are going to chekck out something, so look out: Here is an 'if'
- Even though you now know we will test something, we add puctuation to tell you where the condition starts: an opening parenthesis.
- Now comes the condition: age < 12
- To make sure that you understand that we are done with the condition, we have added a closing parentheses.
- Even though we are done with the condition and ready to go on with the action, we have added an opening brace so that there is no doubt that the action starts here.
- To make sure that you don't overlook the fact that this is a conditional action, we put that brace on a new line.
- On the next line, we have stated the action: charge = child_fare
- To make sure that you understand which actions are conditional, we have indented those statements by four positions.
- To make sure that you see that this is one complete action, we have added a semicolon at the end.
- To make sure that you see that this is the end of all conditional actions, we have marked it with a closing brace.
- To make sure that you don't overlook that this is the end of the conditional actions, we have put the closing brace on a line by itself.
- To make sure that you don't overlook that we now return to actions that are unconditionally executed, we set it off by a blank line.
All of this is explicitly expressed when code goes like (C style):
[blank line]
if (age < 12)
{
charge = childfare;
}
[blank line] rather than (Pascal style):
if age < 1 then charge = childfare; Pascal does require the 'then' keyword, but the closing semicolon may be superfluous, needed only if what follows is a block. (A single statement is a block.)
Lots of C programmers insist that adding a lot of non-action syntactic elements, such as parentheses, braces, blank lines, ..., although they provide no problem/action specific information, they are essential for understanding problem or solution actions. We do mentally process the entire list of "decorations" quoted above to gain this understanding. I am not claiming that costs a lot of effort, but it is there.
I see it as a reminiscence of the 'structured writing' idea, of 'structure before conents'. Obviously you e.g. indicate (usually by indenting) a set of conditional actions. If (the language designers wasn't capable of handling a single action as a block, so you must add braces around it, or or require you to put parentheses around a condition), you must of course {do that}. But I do !confuse syntactical workarounds with readability!
I know from experience that it helps to double space my code when showing it to others. Even if the opening brace is at the end of the line above, that is inessential - the other person may even overlook that there is a completely blank line before, say, the loop body (rather than a brace line). He may overlook that there are blank lines between every statement: Some people put blank lines around every "structured" statement, such as if-statements, so the difference from double-spacing is minimal.
You might argue that doublespacing improves readability indeed. Then, leave it to the display or print function! When you work on a method of 30-40 statements, you should be able to see all on the screen, without having to scroll up and down over three screenfuls!
|
|
|
|
|
You're comparing code to a book that you read. It's not read in that way.
I'm not going to argue; just learn C++.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
There was actually a study a number of years ago where a large panel of softare developers were randomly split into to grops: One half was given the source code of a program in a layout inspired by the way you write prose text, as a narrative. The other half got it as we (read: C programmer) usually lay out code, e.g. wiht premise and conclusion split on two lines, with a brace opening line inbetween. The source code, in the sense: the sequence of tokens, was identical, only the layout was different.
The two groups were given the same amount of time to make themselves familiar with the program code. Then they went through an extensive questionnarie to judge how well they had understood the workings of the program. The results showed that those programmers who had read the prose-inspired layout of the source code scored significantly higher, they had a better understanding of the program.
I'm not going to argue; just learn C++. When did I learn C++? We obtained an early pre-release that compiled not to binary code but to K&R C, so we got a chance to see how classes were represented, with the method tables etc. How object instances were linked to the class object. How subclasses were implmented. An interesting learning experience! This was at the end of my studies, which were completed in 1983, and I am somewhat surprised that the first official C++ release was not until 1985. So I guess I have known C++ since it was a fetus.
Someone said that "Unix is user friendly, it is just a little picky about who it accepts as friends". You could say the same about C++. And then I could say like Peter Schieckele remarked: Well, I've got a new set of friends now ...
|
|
|
|
|
Member 7989122 wrote: The results showed that those programmers who had read the prose-inspired layout of the source code scored significantly higher, they had a better understanding of the program. Because they had to read the entire thing and build a model in their head; try that in a large brownfield application instead of regular debugging.
Member 7989122 wrote: Someone said that "Unix is user friendly In a similar way that I am friendly. Most people have a different concept of the word.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: Because they had to read the entire thing and build a model in their head OK, if you think that understanding how the program works is undesirable (or impossible), and believe that something gets better by tripling the line count in the source file by adding lots of blank lines, putting braces and parentheses and maybe even semicolons on separate lines... If that is your taste, feel free too do so. Even if I dive into some huge system where I don't have a chance in a million to understand the entire code, the very least you could expect is that I understand a single method/function, and hopefully an entire module or even subsystem. If a more "prosaic" layout helps me grasp the logic, I am happy with that, even when I do not understand the entire system.
|
|
|
|
|