diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-15 04:59:42 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-15 04:59:42 +0000 |
commit | f4e03dfb01e5056bb8eab6846912f4a3d1d01e3a (patch) | |
tree | f6708633a667befee64e88b682e327c3df62bcd5 /gcc/README.Portability | |
parent | 1f41937115fcd3c362ea5bcd93ca89f7b09b8a4d (diff) | |
download | gcc-f4e03dfb01e5056bb8eab6846912f4a3d1d01e3a.tar.gz |
* README.Portability: Correct example about calling a function
through a pointer to function. Format wide paragraphs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35043 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/README.Portability')
-rw-r--r-- | gcc/README.Portability | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/README.Portability b/gcc/README.Portability index d6c8aecaa5d..cc5fa32d56a 100644 --- a/gcc/README.Portability +++ b/gcc/README.Portability @@ -155,22 +155,23 @@ ansidecl.h for the definitions of the above macros and more. #define PARAMS(paramlist) () /* K+R C. */ #define VPARAMS(args) (va_alist) va_dcl -One aspect of using K+R style function declarations, is you cannot have -arguments whose types are char, short, or float, since without prototypes (ie, -K+R rules), these types are promoted to int, int, and double respectively. +One aspect of using K+R style function declarations, is you cannot +have arguments whose types are char, short, or float, since without +prototypes (ie, K+R rules), these types are promoted to int, int, and +double respectively. Calling functions through pointers to functions ----------------------------------------------- K+R C compilers require brackets around the dereferenced pointer -variable. For example +variable, whereas ISO C relaxes the syntax. For example typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *)); - p->handler (pfile, p->arg); + *p->handler (pfile, p->arg); needs to become - (p->handler) (pfile, p->arg); + (*p->handler) (pfile, p->arg); Macros @@ -244,11 +245,12 @@ them. Suffixes on Integer Constants ----------------------------- -K+R C did not accept a 'u' suffix on integer constants. If you want to declare -a constant to be be unsigned, you must use an explicit cast. +K+R C did not accept a 'u' suffix on integer constants. If you want +to declare a constant to be be unsigned, you must use an explicit +cast. -You should never use a 'l' suffix on integer constants ('L' is fine), since it -can easily be confused with the number '1'. +You should never use a 'l' suffix on integer constants ('L' is fine), +since it can easily be confused with the number '1'. Common Coding Pitfalls |