| From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
|---|---|
| To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Subject: | Re: Add some const decorations to prototypes |
| Date: | 2017-11-10 15:29:50 |
| Message-ID: | alpine.DEB.2.20.1711101626180.668@lancre |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> Would it make sense that the function returns "const void *", i.e. the cast
> is not on the const part but on the pointer type part?
Or maybe you do not really need a cast, the following code does not
generate any warning when compiled with clang & gcc.
#include <stdio.h>
// const void * would be ok as well
void * msg_fun(void)
{
return "hello world";
}
int main(void)
{
const char * msg = msg_fun();
printf("message: %s\n", msg);
return 0;
}
Or basically all is fine, I'm just nitpicking for nothing, shame on me.
As I said, I rather like more precise declarations.
--
Fabien.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2017-11-10 15:34:48 | Re: Simplify ACL handling for large objects and removal of superuser() checks |
| Previous Message | Fabien COELHO | 2017-11-10 15:17:52 | Re: Add some const decorations to prototypes |