Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #12624

Re: inline

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: inline
Date 2011-11-03 13:51 -0700
Organization None to speak of
Message-ID <lnbostgca3.fsf@nuthaus.mib.org> (permalink)
References <j8ubn1$6vb$1@speranza.aioe.org> <87mxcdfair.fsf@blp.benpfaff.org> <j8upic$fu8$1@speranza.aioe.org>

Show all headers | View raw


"Mark" <mark_cruzNOTFORSPAM@hotmail.com> writes:
> "Ben Pfaff" <blp@cs.stanford.edu> wrote in message 
> news:87mxcdfair.fsf@blp.benpfaff.org...
>>> is it required to have 'inline' keywoard before type in a function
>>> definition/declaration? For example, what is correct:
>>>
>>> inline int small_func(void)
>>> {
>>>     /* do something */
>>> }
>>>
>>> or
>>>
>>> int inline small_func(void)
>>> {
>>>     /* do something */
>>> }
>>
>> Both are correct but the former is customary.
>>
>>> Also - is the same true for functions having static definition?
>
> For the second case "gcc -std=c99 -pedantic -W -Wall" gives
> warning: 'inline' is not at beginning of declaration. Why does
> gcc care about the sequence if both representations are correct ?

C99 6.11.5 says:

    The placement of a storage-class specifier other than at the
    beginning of the declaration specifiers in a declaration is an
    obsolescent feature.

This doesn't apply to function declarations, but I would think that the
placement of "inline" should be treated similarly.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

inline "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-11-03 11:13 -0400
  Re: inline blp@cs.stanford.edu (Ben Pfaff) - 2011-11-03 09:14 -0700
    Re: inline "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-11-03 15:20 -0400
      Re: inline blp@cs.stanford.edu (Ben Pfaff) - 2011-11-03 12:50 -0700
      Re: inline Kaz Kylheku <kaz@kylheku.com> - 2011-11-03 20:10 +0000
      Re: inline Keith Thompson <kst-u@mib.org> - 2011-11-03 13:51 -0700

csiph-web