Timeline for Is it bad practice to use a C++ compiler just for function overloading?
Current License: CC BY-SA 3.0
37 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 13, 2017 at 18:58 | answer | added | Basile Starynkevitch | timeline score: 1 | |
Dec 13, 2017 at 18:26 | answer | added | user204677 | timeline score: 1 | |
Dec 13, 2017 at 13:19 | history | edited | Snoop |
edited tags
|
|
Nov 1, 2017 at 20:51 | history | edited | Snoop |
edited tags
|
|
Jun 12, 2017 at 9:58 | comment | added | Snoop | @mpdonadio Looking back at this... Do you have any reference as to where you learned about used (void *) when blasting things to memory mapped device/port I'd like to know more. | |
May 2, 2017 at 14:05 | vote | accept | Snoop | ||
Apr 24, 2017 at 20:18 | answer | added | nikhil_kotian | timeline score: 2 | |
Apr 23, 2017 at 11:43 | comment | added | user207421 | 'Bad pracitce' compared to what? The question is meaningless without a referent. There is no such thing as 'good practice' and 'bad practice'. The choice you have to make is between this and some unstated alternative, and the choice should be made primarily on cost grounds and secondarily on 'technical debt' grounds, i.e. maintainability. | |
Apr 23, 2017 at 9:50 | comment | added | Andreas Wallner | We also use C++ for our embedded projects on (sometimes) very small controllers (<1k RAM), and features like overloading, static_assert, namespaces, stricter typing to avoid bugs, even templates (e.g. for typesafe memcpy), const correctness, etc. improved our code. Good C++ is what fits your application, cherrypicking features is fine if you know why you do it (see e.g. the JSF++ coding standard by Bjarne). At least parts of the C++ community think so as well, e.g. see youtu.be/D7Sd8A6_fYU, in your case just don't forget to switch off RTTI and exceptions... | |
S Apr 23, 2017 at 0:05 | history | suggested | Lucas Trzesniewski | CC BY-SA 3.0 |
C++ instead of C - the sentence doesn't make sense otherwise
|
Apr 22, 2017 at 21:01 | answer | added | reinierpost | timeline score: 2 | |
Apr 22, 2017 at 18:54 | answer | added | JDługosz | timeline score: 6 | |
Apr 22, 2017 at 18:18 | review | Suggested edits | |||
S Apr 23, 2017 at 0:05 | |||||
Apr 22, 2017 at 6:45 | history | protected | gnat | ||
Apr 21, 2017 at 22:13 | answer | added | John Bollinger | timeline score: 13 | |
Apr 21, 2017 at 16:18 | answer | added | supercat | timeline score: 2 | |
Apr 21, 2017 at 15:04 | comment | added | Snoop | @mpdonadio I thought about that, but if I wanted to ask about it in the context of a specific embedded device I'd probably just go to the vendor forum or website and ask... So I decided against it. What do you think? And, I don't really know how to answer your question of whether it differs based on type. | |
Apr 21, 2017 at 14:56 | comment | added | mpdonadio | @Snoopy You didn't tag this with embedded-systems. Does code actually differ based on type (other than value vs pointer)? Typically, I always used (void *) when blasting things to memory mapped device/port. | |
Apr 21, 2017 at 14:01 | comment | added | Alex Celeste | C already supports overloading. | |
Apr 21, 2017 at 12:41 | comment | added | Snoop |
@Jules There is/was a C compiler that doesn't allow you to have // comments!?
|
|
Apr 21, 2017 at 12:23 | history | edited | Doc Brown | CC BY-SA 3.0 |
improved wording
|
Apr 21, 2017 at 12:20 | comment | added | Snoop | @DocBrown Yeah, but I read you're response and agree with your statements. You make the edit, I insist. | |
Apr 21, 2017 at 12:16 | history | edited | Snoop | CC BY-SA 3.0 |
Want to address some questions that people had.
|
Apr 21, 2017 at 12:00 | comment | added | Snoop | @DocBrown Why didn't you just edit it? You're correct, I see what you're saying so... sure I can edit it. | |
Apr 21, 2017 at 8:28 | comment | added | Criticizing Israel not allowed |
@Jules I was worked on a plain C project (for my job), then one day I decided I wanted to use std::string , so I made it a mixed C/C++ project. It was very painless - I just changed my file extension to cpp and added the appropriate compilation rule.
|
|
Apr 21, 2017 at 4:21 | comment | added | Jules | @Davislor - actually, I haven't worked on a plain C project since 1997... | |
Apr 21, 2017 at 1:54 | comment | added | Davislor |
@Jules I’m sure you know this and were thinking back a while, but in case somebody reading this doesn’t: // comments have been in the C standard since C99.
|
|
Apr 21, 2017 at 1:06 | comment | added | Pharap | "For what I am doing, there is no dynamic memory allocation on the processor and the program is overall fairly simple. Not to mention that the device has almost no processor power or resources. There's really no strong need to use any C++ whatsoever." I hope the first of those two sentences are supposed to be reasons to not use C++, because they're pretty bad ones if they are. C++ is perfectly fine to use with embedded systems. | |
Apr 20, 2017 at 23:04 | comment | added | Criticizing Israel not allowed | When you say "use a C++ compiler" you mean "use C++". Just say it. You can't compile C with a C++ compiler, but you can switch from C to C++ easily, which is what you'd actually be doing. | |
Apr 20, 2017 at 23:03 | comment | added | FISOCPP | If you decide to stick with C (which IMHO is the right thing to do) there is generic selection which may help you (directly look at the examples). | |
Apr 20, 2017 at 21:55 | history | tweeted | twitter.com/StackSoftEng/status/855178222614564866 | ||
Apr 20, 2017 at 20:00 | comment | added | Jerry Coffin | The bad practice would be restricting yourself to C when you have a good use for features it doesn't provide. | |
Apr 20, 2017 at 19:43 | comment | added | Jules |
I've been known to use C++ for a project only using C features just so that I can have // comments. If it works, why not?
|
|
Apr 20, 2017 at 19:34 | answer | added | Jörg W Mittag | timeline score: 57 | |
Apr 20, 2017 at 19:20 | answer | added | Philip Kendall | timeline score: 79 | |
Apr 20, 2017 at 19:18 | answer | added | R Sahu | timeline score: 15 | |
Apr 20, 2017 at 18:45 | history | asked | Snoop | CC BY-SA 3.0 |