This repository was archived by the owner on Oct 1, 2024. It is now read-only.
This repository was archived by the owner on Oct 1, 2024. It is now read-only.
Arduino plugin does not return proper sizeof() #913
Open
Description
I have encountered a problem with the plugin that incorrectly reports the size of types when using the Arduino SAMD21 core.
Here is an example:
#include <Arduino.h>
void setup()
{
uint32_t x = sizeof(x);
Serial.begin(115200);
Serial.println(x, DEC);
}
void loop()
{
}
When you hover over the "sizeof", vscode displays "(uint32_t)8UL. This is not correct. The proper size of this type is 4 on the Arduino SAMD21 architecture.
When you compile the code, sizeof returns the proper size of the type (in this case, 4).
Here is a copy of my c_cpp_properties.json:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/Users/stevenslupsky/Library/Arduino15/packages/arduino/tools/**",
"/Users/stevenslupsky/Library/Arduino15/packages/arduino/hardware/samd/1.8.2/**"
],
"forcedInclude": [
"/Users/stevenslupsky/Library/Arduino15/packages/arduino/hardware/samd/1.8.2/cores/arduino/Arduino.h"
],
"defines": [
"__CC_ARM",
"F_CPU=48000000L",
"ARDUINO=10607",
"ARDUINO_SAMD_MKRWAN1300",
"ARDUINO_ARCH_SAMD",
"USE_ARDUINO_MKR_PIN_LAYOUT",
"__SAMD21G18A__",
"USB_VID=0x2341",
"USB_PID=0x8053",
"USBCON",
"USE_BQ24195L_PMIC",
"VERY_LOW_POWER"
],
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
],
"intelliSenseMode": "gcc-x64",
"compilerPath": "/Users/stevenslupsky/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++",
"cStandard": "c11",
"cppStandard": "c++11"
}
],
"version": 4
}