VS Arduino
Visual Micro >> Visual Studio 2017, 2019, 2022 >> Intellisense fail with structure aligment/padding
https://www.visualmicro.com/forums/YaBB.pl?num=1445445049

Message started by Serenifly on Oct 21st, 2015 at 4:30pm

Title: Intellisense fail with structure aligment/padding
Post by Serenifly on Oct 21st, 2015 at 4:30pm
You might know that on a 32-Bit system structures are padded to the system's word size:
https://en.wikipedia.org/wiki/Data_structure_alignment

This isn't an issue on the 8-Bit AVRs. This prints "7" as one would naively assume (4 + 2 + 1):

Code (]
struct integerData_t
{
  long val1;
  int val2;
  byte val3;
};

void setup()
{
  Serial.begin(9600);
  Serial.println(sizeof(integerData_t));
}
[/code):



However when you then do this:
[code]
const unsigned long size = sizeof(integerData_t);


And hover the mouse over the constant name, Intellisense claims that it is 12! But it also prints as 7.

I know that Intellisense doesn't understand all AVR Syntax, but I had assumed that in such a case it shows what the actual compiler (avr gcc) thinks. But here too it seems that Intellisense shows what the underlying VS Compiler does, which is 32 or even 64 Bit.

This isn't a huge complaint and probably not something that can be fixed, but I thought that it's interesting.

Title: Re: Intellisense fail with structure aligment/padding
Post by Visual Micro on Oct 21st, 2015 at 4:34pm
Thanks

Yes currently Visual Micro leaves the project intellisense pointing to the Microsoft tool chain. It is slowly becoming more of a problem but gives the simplest project configuration.


Title: Re: Intellisense fail with structure aligment/padding
Post by Visual Micro on Oct 21st, 2015 at 4:58pm
ps: if you see any project properties that would help with this or other intellisense settings then please let me know.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.