Search:
Forum
General C++ Programming
which attribute syntax should i use ("[[
which attribute syntax should i use ("[[gnu::attr]]" or "__attribute__ ((attr))")
Apr 25, 2021 at 8:19pm UTC
Kallinteris Andreas
(45)
1
2
3
4
5
__attribute__ ((pure))
int
foo() {
return
2;} [[gnu::pure]]
int
bar() {
return
2;}
Both of those attributes do the same thing the second one is not documented in GCC manual
c++ core guidelines recommend using the second method (
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#gsl-guidelines-support-library)
(I think)
which one is the preferred method
Last edited on
Apr 25, 2021 at 8:19pm UTC
Apr 25, 2021 at 8:55pm UTC
jonnin
(11437)
not sure it matters since it is nonstandard and unportable?
Apr 25, 2021 at 9:20pm UTC
mbozzi
(3932)
Prefer the latter because it uses the standard attribute syntax.
Last edited on
Apr 25, 2021 at 9:24pm UTC
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs