bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/9] sockets, sys_stat: remove AC_C_INLINE in MSVC-only cases


From: Bruno Haible
Subject: Re: [PATCH 4/9] sockets, sys_stat: remove AC_C_INLINE in MSVC-only cases
Date: Mon, 01 Oct 2012 00:22:43 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Paul,

> * m4/sockets.m4 (gl_SOCKETS):
> * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H):
> Remove AC_C_INLINE.  Here, 'inline' is used only in MSVC
> environments where it's already guaranteed to work

Nope. MSVC does *not* support 'inline' for functions.

Quoting <http://msdn.microsoft.com/en-us/library/z8y1yy88%28v=vs.71%29.aspx>:
  "The inline keyword is available only in C++.
   The __inline and __forceinline keywords are available in both C and C++.
   For compatibility with previous versions, _inline is a synonym for __inline."

This is what I see with MSVC 9:

$ cat foo.c
inline int square (int x)
{
  return x * x;
}

$ cl -nologo foo.c -c                  
foo.c
foo.c(1) : error C2054: Nach 'inline' muss '(' folgen
foo.c(2) : error C2085: 'square': Nicht in der formalen Parameterliste enthalten
foo.c(2) : error C2143: Syntaxfehler: Es fehlt ';' vor '{'

$ cl -nologo foo.c -c -Dinline=_inline
foo.c

$ cl -nologo foo.c -c -Dinline=__inline
foo.c

So, for functions, in C mode, it does understand '_inline' and '__inline'
but not 'inline'.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]