microsoft / microsoft/vscode-cpptools

Intellisense error sizeof(uint32_t) is 8 bytes

Open
#12,377 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Configuration Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Linux x64 6.8.10-300.fc40.x86_64
  • VS Code Version: 1.90.0
  • C/C++ Extension Version: v1.20.5
  • If using SSH remote, specify OS of remote machine: no
Bug Summary and Steps to Reproduce

Bug Summary:
I'm work on ESP-IDF get C/C++(1578), and hover sizeof(uint32_t) get (size_t)8U, hover uint32_t get typedef unsigned long uint32_t

In Windows 10 i get sizeof(uint32_t) is (size_t)4U

code snippets

    switch (size) {
        case sizeof(uint8_t): {
            ret = nvs_set_u8(__nvs_handle, key, *((uint8_t *)data));
        } break;
        case sizeof(uint16_t): {
            ret = nvs_set_u16(__nvs_handle, key, *((uint16_t *)data));
        } break;
        case sizeof(uint32_t): {
            ret = nvs_set_u32(__nvs_handle, key, *((uint32_t *)data));
        } break;
        case sizeof(uint64_t): {
            ret = nvs_set_u64(__nvs_handle, key, *((uint64_t *)data));
        } break;
        default: {
            ret = nvs_set_blob(__nvs_handle, key, (void *)data, size);
        } break;
    }

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior:

Configuration and Logs
c_cpp_properties.json

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "includePath": [
                "${config:idf.espIdfPathWin}/components",
                "${workspaceFolder}"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPathWin}/components",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "cStandard": "c11",
            "compilerPath": "${config:idf.toolsPath}/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-gcc"
        }
    ],
    "version": 4
}
Other Extensions

ESP_IDF: espressif.esp-idf-extension

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with c_cpp_properties.json and the workspace build/compile_commands.json, then verify the configured riscv32-esp-elf-gcc compiler and IntelliSense type information for uint32_t. Reproduce the hover result on Linux and Windows; done when sizeof(uint32_t) reports the expected size for the configured target.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.