Is (see inside) a good idea to do to a public API |
|
Hi,
I know this is off-topic because it's C-specific, but comp.lang.c discussion level seems to low, but comp.lang.c.moderated is all but dead and comp.std.c seems just as inappropriate. Please bear with me, here goes...
I have a public API like this:
extern "C" rettype api(param* p);
Now... This really is a mistake, it's an input parameter so it should have been:
extern "C" rettype api(const param* p);
Question: is this safe to do given that this is a public API and I don't control client code? Any downsides?
(To be frank: I am annoyed by GCC warnings in some old code, it's about char* and api("toto")).
TIA,
Goran.
|
Re: Is (see inside) a good idea to do to a public API |
|
On Thu, 28 Aug 2014 04:26:34 -0700, goran.pusic wrote:
> Hi,
>
> I know this is off-topic because it's C-specific, but comp.lang.c
> discussion level seems to low, but comp.lang.c.moderated is all but dead
> and comp.std.c seems just as inappropriate. Please bear with me, here
> goes...
>
> I have a public API like this:
>
> extern "C" rettype api(param* p);
>
> Now... This really is a mistake, it's an input parameter so it should
> have been:
>
> extern "C" rettype api(const param* p);
>
> Question: is this safe to do given that this is a public API and I don't
> control client code? Any downsides?
>
> (To be frank: I am annoyed by GCC warnings in some old code, it's about
> char* and api("toto")).
Yes, it is safe, and should have no downsides as fa as I know.
M4
|