Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
5 votes

Does int array[100] = {0} construct work on Arduino?

This construct does work in Arduino IDE. In fact, = { 0 } is one of the iconic idioms of C language. It can be used to zero-initialize an object of any type in C. In C++ things are a bit more ...
AnT stands with Russia's user avatar
4 votes
Accepted

Accessing a C++ static variable from gcc inline asm

Try this: asm volatile("lds r24, %0" : : "i" (&Driver.ISR_param)); The "i" constraint means you provide an integer constant. It can be any integer, unlike the uppercase "I" constraint which is ...
Edgar Bonet's user avatar
  • 43.2k
4 votes

Does int array[100] = {0} construct work on Arduino?

The GNU cross compilers for Arduino use C/C++ front-ends and meet some version the language specs. (Although that is a moving target, you can expect a recent IDE version will be compliant with a ...
JRobert's user avatar
  • 15.3k
4 votes
Accepted

Does int array[100] = {0} construct work on Arduino?

I'm used to this way from my desktop C++ programming practice: int array[100] = {0}; I couldn't find any info on whether or not this construct works on Arduino. The = {0} has no actual effect. ...
Majenko's user avatar
  • 105k
2 votes

How do I order the gcc compiler to generate -S flag in Arduino IDE

Compiler flags are defined in the platform.txt of the board you have selected in the Tools > Board menu. You can also add compiler flags via a build.extra_flags property in the boards.txt entry for ...
per1234's user avatar
  • 4,178
2 votes

GCC msg "note: in definition of macro 'max'" error message

I can reproduce your message easily enough: #define max(a,b) ((a)>(b)?(a):(b)) void setup() { int b = 66; unsigned int c = 42; analogWrite (3, max (b, c)); } void loop() { } I get these ...
Nick Gammon's user avatar
  • 38.3k
2 votes
Accepted

C++ State Machine / Wpmf-convesion

A pointer to a member function is not allowed in C++. GCC can allow it, but moans at you because it's non-standard. In C++ the normal way of dealing with the kind of thing you want is through class ...
Majenko's user avatar
  • 105k
2 votes
Accepted

How do I make Arduino IDE use a specific version of GCC in Debian?

As Majenko pointed out, I should have used a tarball from the official site instead of the repositories. Which makes me wonder why that package wasn't deprecated or something...
Dmitry Fedorkov's user avatar
1 vote

using references to SFRs in gcc inline assembler

You could use pointers instead of references. With pointers, you have the separate notions of “constant pointer” and “pointer to constant”. A reference is a kind of pointer coated with syntactic sugar....
Edgar Bonet's user avatar
  • 43.2k
1 vote
Accepted

UECIDE: linker error with U8g2 library

The layout of that library is in a non-standard format with folders that UECIDE doesn't know to look for or how to deal with. The main culpret is the inclusion of big chunks of code in a "clib" ...
Majenko's user avatar
  • 105k
1 vote

GCC msg "note: in definition of macro 'max'" error message

Note to the future: (My particular case was a function call with several parameters. One had the max(a,b), and another parameter had an error. It used a different macro, which may have pushed the ...
HiTechHiTouch's user avatar
1 vote

Works with gcc, not with Arduino. error: taking address of temporary array

See Using array init list as temporary in C++11? You can solve it by using const. This compiles: char a[8]; void cpaddr(char target[], const byte *source) { int i; for (i=0; i<8; i++) ...
Nick Gammon's user avatar
  • 38.3k

Only top scored, non community-wiki answers of a minimum length are eligible