You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
2Basically you can use C++ as long as you don't (extensively) use: the standard library, exceptions, templates or rtti (do lambdas work? never tried). Whether you'd want to call the remaining language really 'c++' is another question.Voo– Voo2018-01-25 11:22:11 +00:00Commented Jan 25, 2018 at 11:22
-
2@Voo: On the Arduino, templates are not necessarily a bad thing.Edgar Bonet– Edgar Bonet2018-01-25 12:20:50 +00:00Commented Jan 25, 2018 at 12:20
-
2@Edgar Very clever trick, but certainly not the way you'd use templates in general code. A better way to phrase it might be that you have to be very careful with how you use templates since they can very easily lead to large quantities of code being generated behind your back.Voo– Voo2018-01-25 13:46:38 +00:00Commented Jan 25, 2018 at 13:46
-
2@JAB It's generally recommended for efficient code to try and forward to non-generic functions (e.g. standard libraries cast T's to void* and deal with those). Absolutely doable but makes for awkward programming and is easily forgotten. Nick's template example is pretty similar: Instead of forwarding the byte* and size to a generic function we now have almost identical code multiple times in memory. If you had to write it by hand you'd notice the duplication.Voo– Voo2018-01-26 21:35:23 +00:00Commented Jan 26, 2018 at 21:35
-
1@Curious The general gist is that C++ is complex enough that it can be rather hard to know what exactly the compiler is doing in the background. Then you also have to rely on your compiler to do certain optimizations for certain things to be feasible (do you know whether your compiler does COMDAT folding?). It can be done, usually by limiting yourself to certain features, but it's a bit fragile (i.e. a tiny change can lead to very different non-functional behavior).Voo– Voo2023-03-01 11:26:43 +00:00Commented Mar 1, 2023 at 11:26
|
Show 5 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. arduino-uno), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-cpp