News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Creating an abbreviation that expands to some code which uses C++ [[attribute]]

Started by Zeus_, November 06, 2020, 11:10:17 AM

Previous topic - Next topic

Zeus_

I'm trying to create an abbreviation that expands to some code containing the [[maybe_unused]] attribute in C++. However, this triggers the Script Expansion feature of C::B Abbreviations, which happens to use the [[]] operator for its functionality.

Take this code as an example for an abbreviation.


void func ([[maybe_unused]] int n) { ... }


When activating the abbreviation using Ctrl+J, this gives:


Script Run Error

Filename: CommandLine
Error: the index 'maybe_unused' does not exist.


How do I use an abbreviation that expands to code containing something of the form [[cpp_attribute]] without triggering script expansion?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]