Skip to content

Commit 2b8dd5a

Browse files
committed
Fix function definition example to show definition instead of declaration
Signed-off-by: Thomas Nyman <[email protected]>
1 parent 8894104 commit 2b8dd5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/Compiler-Hardening-Guides/Compiler-Annotations-for-C-and-C++.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ In `__attribute__` keyword syntax:
107107
void my_free(void *ptr);
108108
109109
// Denotes that my_malloc will return with a dynamically allocated piece of memory which must be freed using my_free.
110-
void *my_malloc(size_t size) __attribute__ ((malloc, malloc (my_free, 1)));
110+
void *my_malloc(size_t size) __attribute__ ((malloc, malloc (my_free, 1))) { … }
111111
~~~
112112

113113
Note that to benefit both from the associated optimizations and improved detection of memory errors functions should be marked with _both_ the form of the attribute without arguments and the form of the attribute with one or two arguments. [[Extended example at Compiler Explorer](https://godbolt.org/z/bc97ahbnd)]

0 commit comments

Comments
 (0)