portability of function prototypes?

2003-04-12 Thread Alexander Stohr
i am seeing constructs like this at
several locations of the XFree86 sources:

*.h:
  extern char *Xpermalloc(
  #if NeedFunctionPrototypes
  unsingend int /* size */
  #endif
  );

*.c:
  char *Xpermalloc(unsigned int length)
  { ... }

  #if NeedFunctionPrototypes
  XrmQuark XrmStringToQuark(
  _Xconst char *name)
  #else
  XrmQuark XrmStringToQuark(name)
  XrmString name;
  #endif
  { ... }

for my impression the applied macro check
is obsolete nowadays and should not used
any longer for current coding. the phrase
inside the first #if #endif is a needed one.

i think for the second one the if-case is 
probably the prefered coding style whilst 
the else-case is the obsolete coding style.

am i right? this is a pure leftover?
or am i wrong and some targets do still
have some heavy dependencys on that?

are there some coding guidlines somewhere
in the tree that do outline on that subject?
i am personally targetting on compatible
coding and avoiding breakage of other codes.

-Alex.

PS: i am hoping for a response of some long term 
XFree86 developer to answer this.

___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: portability of function prototypes?

2003-04-12 Thread Matthieu Herrb
Alexander Stohr wrote (in a message from Saturday 12)
  i am seeing constructs like this at
  several locations of the XFree86 sources:
  
  *.h:
extern char *Xpermalloc(
#if NeedFunctionPrototypes
unsingend int /* size */
#endif
);
  
  *.c:
char *Xpermalloc(unsigned int length)
{ ... }
  
#if NeedFunctionPrototypes
XrmQuark XrmStringToQuark(
_Xconst char *name)
#else
XrmQuark XrmStringToQuark(name)
XrmString name;
#endif
{ ... }
  
  for my impression the applied macro check
  is obsolete nowadays and should not used
  any longer for current coding. the phrase
  inside the first #if #endif is a needed one.
  
  i think for the second one the if-case is 
  probably the prefered coding style whilst 
  the else-case is the obsolete coding style.
  
  am i right? this is a pure leftover?
  or am i wrong and some targets do still
  have some heavy dependencys on that?
  
  are there some coding guidlines somewhere
  in the tree that do outline on that subject?
  i am personally targetting on compatible
  coding and avoiding breakage of other codes.

This is a leftover from the times where X could get compiled on
non-ansi compiler. Since X11R6.3 an ANSI C compiler is needed. 
There's no reason to use this in new code. 

We are removing them slowly, whenever a file that still use them 
is edited. 

Matthieu
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: portability of function prototypes?

2003-04-12 Thread Tony Sweeney
Alexander Stohr wrote:
i am seeing constructs like this at
several locations of the XFree86 sources:
[Constructs deleted]

  { ... }

[sane rationale deleted]

-Alex.

PS: i am hoping for a response of some long term 
XFree86 developer to answer this.
I shouldn't pose as an XFree86 developer, since I'm not one, but in a 
previous life I've been a porting engineer, and I've come across this 
sort of nonsense before.  Commercial enterprises strive to ensure 
backwards compatibility, yea unto the ancient compiler, and the dusty 
video card.  At some point you have to force the new.  Code for ANSI, 
and the compiler gremlins will quiet their chatter -- there are subtle 
stack alignment errors written into the C standards -- there be dragons.

Tony.

--
quis custodiet ipsos custodes? -- Juvenal VI, 347-8
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel