Click here to Skip to main content
15,891,828 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Things I find buried in the C++ reference Pin
Espen Harlinn14-Mar-21 2:28
professionalEspen Harlinn14-Mar-21 2:28 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch13-Mar-21 16:22
mvahoney the codewitch13-Mar-21 16:22 
GeneralRe: Things I find buried in the C++ reference Pin
Espen Harlinn14-Mar-21 4:04
professionalEspen Harlinn14-Mar-21 4:04 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch14-Mar-21 6:19
mvahoney the codewitch14-Mar-21 6:19 
GeneralRe: Things I find buried in the C++ reference Pin
Espen Harlinn14-Mar-21 10:38
professionalEspen Harlinn14-Mar-21 10:38 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch14-Mar-21 10:52
mvahoney the codewitch14-Mar-21 10:52 
GeneralRe: Things I find buried in the C++ reference Pin
Espen Harlinn14-Mar-21 12:42
professionalEspen Harlinn14-Mar-21 12:42 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch14-Mar-21 12:54
mvahoney the codewitch14-Mar-21 12:54 
Espen Harlinn wrote:
it is also a great way to discover that any occurrence of code-bloat has little (if anything?) to do with the C++ language.


Haha I just got into a thing here on the lounge the other day where I was talking about how, any code you can produce in C i can produce the *precise* equivalent in C++. The reason I said that was because some people think C++ isn't as efficient as C, but you can literally do everything you can do with C with C++, even if a little bit of it has to be done in a different way - which will still generate the same machine code.

C++ isn't bloated, I tell people. Generic programming and metaprogramming make it *easy* to introduce code bloat, but if used judiciously it can actually make your code smaller than what you would have coded manually. Of course, you already know all of this, but I'll be writing an article about it soon.


Espen Harlinn wrote:
Apart from RTTI and exceptions there should be no overhead compared to C. Personally I use exceptions extensively for error handling, and also I like to think that I write fast code,


I think the issue here is that exceptions make your stack bigger, but it has been a long time since I have dived into exceptions. I avoid them on machines where I'm working with as little as 4kB of RAM.

The truth is on these little machines, there's little to do under a lot of error cases other than abort, for several reasons - no operating system, so nothing to drop down to. often as not it's a hardware issue which is catastrophic anyway. I mean, aside from checking user interface stuff, and making sure disks are inserted, I usually let the things *run til fail* and don't if/check everything. If the hardware's going to go all elephant, it didn't help me to abort() 3 instructions earlier than my machine would have anyway, if that makes sense. Hence, I don't do if()s everywhere. But this makes things *harder* to code not easier. It's easier to error check than to determine when it's relatively safe not to.


I've never used RTTI and because I lack imagination I can't think of a use case for it that isn't better solved either with metaprogramming and SFINAE or C# depending on what you're doing, so I can't speak to it.
Real programmers use butterflies

GeneralRe: Things I find buried in the C++ reference Pin
Espen Harlinn15-Mar-21 11:29
professionalEspen Harlinn15-Mar-21 11:29 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch15-Mar-21 11:57
mvahoney the codewitch15-Mar-21 11:57 
GeneralRe: Things I find buried in the C++ reference Pin
Stuart Dootson15-Mar-21 1:09
professionalStuart Dootson15-Mar-21 1:09 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch15-Mar-21 2:22
mvahoney the codewitch15-Mar-21 2:22 
GeneralRe: Things I find buried in the C++ reference Pin
Stuart Dootson15-Mar-21 3:31
professionalStuart Dootson15-Mar-21 3:31 
GeneralRe: Things I find buried in the C++ reference Pin
honey the codewitch15-Mar-21 3:52
mvahoney the codewitch15-Mar-21 3:52 
GeneralRe: Things I find buried in the C++ reference Pin
James Curran15-Mar-21 4:43
James Curran15-Mar-21 4:43 
GeneralOh no! Pin
Jörgen Andersson12-Mar-21 9:45
professionalJörgen Andersson12-Mar-21 9:45 
GeneralRe: Oh no! Pin
NotTodayYo12-Mar-21 10:09
NotTodayYo12-Mar-21 10:09 
GeneralRe: Oh no! Pin
RickZeeland12-Mar-21 21:04
mveRickZeeland12-Mar-21 21:04 
GeneralExploding Plastic Pin
honey the codewitch12-Mar-21 9:08
mvahoney the codewitch12-Mar-21 9:08 
GeneralRe: Exploding Plastic Pin
OriginalGriff12-Mar-21 11:17
mveOriginalGriff12-Mar-21 11:17 
GeneralThought of the Day Pin
OriginalGriff12-Mar-21 4:44
mveOriginalGriff12-Mar-21 4:44 
GeneralRe: Thought of the Day Pin
W Balboos, GHB12-Mar-21 5:22
W Balboos, GHB12-Mar-21 5:22 
GeneralThis was sent to me today ... Pin
CHill6012-Mar-21 3:29
mveCHill6012-Mar-21 3:29 
GeneralRe: This was sent to me today ... Pin
PIEBALDconsult12-Mar-21 3:32
mvePIEBALDconsult12-Mar-21 3:32 
GeneralRe: This was sent to me today ... Pin
CHill6012-Mar-21 3:33
mveCHill6012-Mar-21 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.