This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31893] Please provide an "inout" attribute for function parameters.
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 10 Jun 2015 13:45:22 +0000
- Subject: [Bug c/31893] Please provide an "inout" attribute for function parameters.
- Auto-submitted: auto-generated
- References: <bug-31893-4 at http dot gcc dot gnu dot org/bugzilla/>
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.