How to disable warnings

When we are using a third party library in software development, we may encounter a lot of warning during the compilation. It is possible to disable warnings using compiler flags. This will disable warnings for all codes, it is thus useless when we want the higher warning level in our code.

I have encountered some « unused variable » warning in adding source code in my project. I have disabled these warnings in adding this line just after the variable declaration : __attribute__ ((unused))

I have found the documentation here.

Une réflexion au sujet de « How to disable warnings »

  1. Keep in mind that is a gcc-specific attribute, think about it when you have portability constraints.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *