__attribute__((warn_unused_result)
Mohanlal Jangir
mohanlaljangir@gmail.com
Sat Apr 7 03:14:00 GMT 2007
On 4/6/07, John (Eljay) Love-Jensen <eljay@adobe.com> wrote:
> Hi Mohanlal,
>
> That warning was introduced in GCC 3.4.
>
> HTH,
> --Eljay
>
Hi Eljay,
With same compiler, following program works well (compiles as well as
gives warning)
#include <stdio.h>
class myClass {
public:
int count() __attribute__((warn_unused_result));
};
int myClass::count() {
return printf("hello world\n");
}
int main() {
myClass obj;
obj.count();
return 0;
}
The only problem is, the program does not work if I define the method
inside the class. Any clue ??
Regards,
Mohan
More information about the Gcc-help
mailing list