Обсуждение: Can someone explain this code?

Поиск
Список
Период
Сортировка

Can someone explain this code?

От
Magnus Hagander
Дата:
int
pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,           const char *password, char *PQerrormsg)
{
#ifndef KRB5(void) hostname;            /* not used */
#endif

...

(fe-auth.c)

What does that code actually *do*?

//Magnus


Re: Can someone explain this code?

От
Stephen Frost
Дата:
* Magnus Hagander (magnus@hagander.net) wrote:
> #ifndef KRB5
>     (void) hostname;            /* not used */
> #endif
[...]
> What does that code actually *do*?

Stop the compiler from complaining about an unused argument.
Thanks,
    Stephen

Re: Can someone explain this code?

От
"Marko Kreen"
Дата:
On 7/19/07, Magnus Hagander <magnus@hagander.net> wrote:
> int
> pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
>                            const char *password, char *PQerrormsg)
> {
> #ifndef KRB5
>         (void) hostname;                        /* not used */
> #endif
>
> ...
>
> (fe-auth.c)
>
> What does that code actually *do*?

Somebody tried to work around "unused argument" warning?

-- 
marko


Re: Can someone explain this code?

От
Magnus Hagander
Дата:
On Thu, Jul 19, 2007 at 06:41:17AM -0400, Stephen Frost wrote:
> * Magnus Hagander (magnus@hagander.net) wrote:
> > #ifndef KRB5
> >     (void) hostname;            /* not used */
> > #endif
> [...]
> > What does that code actually *do*?
> 
> Stop the compiler from complaining about an unused argument.

That makes sense, except my compiled didn't warn even when I took it out
:-) Ah, well, thanks for clearifying.

//Magnus


Re: Can someone explain this code?

От
Stephen Frost
Дата:
* Magnus Hagander (magnus@hagander.net) wrote:
> On Thu, Jul 19, 2007 at 06:41:17AM -0400, Stephen Frost wrote:
> > Stop the compiler from complaining about an unused argument.
>
> That makes sense, except my compiled didn't warn even when I took it out
> :-) Ah, well, thanks for clearifying.

It depends on the compiler you're using..  My recollection is that
it shows up at least w/ gcc and -Wall and/or -pedantic.
Thanks,
    Stephen