Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of GCC's -Wpointer-arith

GCC documentation says

-Wpointer-arith Warn about anything that depends on the "size of" a function type or of 'void'. GNU C assigns these types a size of 1, for convenience in calculations with 'void *' pointers and pointers to functions. In C++, warn also when an arithmetic operation involves' NULL'.

But I cannot think of a usecase where this can be useful instead of creating nuisance. Any examples?

like image 800
Shreyas S Avatar asked Dec 19 '12 14:12

Shreyas S


People also ask

What is the purpose of the Gulf Cooperation Council?

The GCC was established in Riyadh, Saudi Arabia, in May 1981. The purpose of the GCC is to achieve unity among its members based on their common objectives and their similar political and cultural identities, which are rooted in Arab and Islamic cultures. Presidency of the council rotates annually.

What are the objectives of the Gulf Cooperation Council gcc population strategies and what policies they are using to achieve them?

The GCC Charter states that the basic objectives are to have coordination, integration and inter-connection between Member States in all fields, strengthening ties between their peoples, formulating similar regulations in various fields such as economy, finance, trade, customs, tourism, legislation, administration, as ...

Is G ++ and gcc the same?

“GCC” is a common shorthand term for the GNU Compiler Collection. This is both the most general name for the compiler, and the name used when the emphasis is on compiling C programs (as the abbreviation formerly stood for “GNU C Compiler”). When referring to C++ compilation, it is usual to call the compiler “G++”.

Which country left gcc?

Iran and Iraq are not part of the GCC. Both countries have a coastline on the Arabian or Persian Gulf, both are Islamic or Muslim countries, Iraq is Arab, Iran is not (is Persian), Iraq has a land border with Kuwait and Saudi Arabia, Iran does not have a land border with any GCC country.


1 Answers

All of those operations are undefined according to the C standard. This warning is useful for pointing out situations where the code may work under GCC, but will fail with other compilers.

like image 53
clarkcox3 Avatar answered Oct 17 '22 11:10

clarkcox3