Re: any reason for the usage of "__attribute__((format(scanf..."?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

"Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> writes:

>   i'm clarifying the meaning and usage of the gcc attributes used in
> the kernel source tree, and i noticed that the gcc manual defines the
> "format" attribute as having four possible archetypes: printf, scanf,
> strftime or strfmon.
>
>   however, it seems that there's no real difference between the
> archetypes printf and scanf:
>
>   int printf(const char *format, ...);
>   int scanf(const char *format, ...);
>
> so is there a reason why someone would use one over the other?

#include <stdio.h>

int main(void)
{
        int n;

        scanf ("%d",   &n);
        printf("%d\n",  n);

        return 0;
}

scanf expects different types for equivalent format strings.

	Hannes

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux