25Fermer27
PpHdLe 23/11/2011 à 21:31
bearbecue (./23) :
bon ben je dois etre un peu couillon mais je vois pas ce qui dit qu'une fonction n'est pas un objet dans la section 6.2.4 Oo (jsuis alle voir ca: http://c0x.coding-guidelines.com/6.2.4.html et ca: http://www.open-std.org/jtc1/sc22/wg14/www/docs/C99RationaleV5.10.pdf )

une fonction, en reprenant les termes du 6.2.4, ca peut avoir un storage "static" ou "allocated", il n'y a rien qui me parait contradictoire entre la definition d'un objet et ce qu'est une fonction. apres il y a peut-etre une distinction faite pour les adresses dans des pages avec les droits en execution, mais je vois ca nulle part.. pis de toutes facons c'est architecture-specific tout ca... confus

C'est en fait une extension du C standard :

J.5 Common extensions
1 The following extensions are widely used in many systems, but are not portable to all
implementations. The inclusion of any extension that may cause a strictly conforming
program to become invalid renders an implementation nonconforming. Examples of such
extensions are new keywords, extra library functions declared in standard headers, or
predefined macros with names that do not begin with an underscore.

J.5.7 Function pointer casts
1 A pointer to an object or to void may be cast to a pointer to a function, allowing data to be invoked as a function (6.5.4).
2 A pointer to a function may be cast to a pointer to an object or to void, allowing a
function to be inspected or modified (for example, by a debugger) (6.5.4).