This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/31893] Please provide an "inout" attribute for function parameters.


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31893

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Daniel Fruzynski from comment #7)
> void __attribute__((const)) func(int* i)
> {
>     *i = 44;
> }

You get a warning because you marked this function const, which tells the
compiler it won't modify *i, so you lied to the compiler.

You should not be marking this function const.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]