This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

no error in strange sintaxis return()


Hello, while I was trying to return local variable as (const char *)
return "value_of_var_a";

I put a strange return, something like this:

return ("%s",a);

> unsigned char *
> laca (const unsigned char *page, const unsigned int id)
> {
>   unsigned char a[SIZE_MARCA];
>   strcpy (a, "Hello");
>   if (id == 1)
>     {
>       return "page1";
>     }
>   else
>     {
> /*printf("%u",("%s",a));*/ /*strange sintaxis*/
>       return ("%s",a); /*strange sintaxis*/
>     };
> }

No warning messages are returned by compiler! Why?
And if I uncomment printf(...), program return correct stream. Commented anything is returned.

Compiler should caught the last argument  of lists only (a).



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]