Skip to content

Feature: Investigate the MSVC extension __declspec property #23

@YexuanXiao

Description

@YexuanXiao

Currently, this extension is supported by MSVC, Clang, and EDG (Intellisense), but not by GCC. It is necessary to check for any unexpected behavior of this extension on MSVC and Clang. If it is available, consider introducing this feature for C++/WinRT Plus. The option -getter-extension needs to be added and options also need to be added for MSBuild.

This extension will bring a C#-like experience to C++ users and help C# users adapt.

Add option -ms-extension-property. When this option is enabled, the function names of the current runtime class's properties will be changed to _get_Property and _set_Property, and the member declaration __declspec(property(get = _get_Property, put = _set_Property)) T Property; will be added.

Doc: https://learn.microsoft.com/en-us/cpp/cpp/property-cpp?view=msvc-170

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationexternalFix this issue may require improvements to external toolsfeatureNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions