From: "John Yates" <jyates@netezza.com>
To: "Gcc-Help \(E-mail\)" <gcc-help@gcc.gnu.org>
Subject: position of inline reserved word
Date: Tue, 05 Jul 2005 14:52:00 -0000 [thread overview]
Message-ID: <F0CD2E5262214F44959AD6AF34ADA66E01D130EF@mail2.netezza.com> (raw)
Personal predilection:
----------------------
Having first encountered strong typing in Pascal
I am one of those programmers who will forever
write
char* ptr
rather than
char *ptr
Issue at hand:
--------------
To make it easy to spot a function name and its
result type I format the definition's function
header across two lines:
<result-type> <class-name> ::
<function-name> ( <format-parameters> )
When writing C++ headers I always provide inline
definitions outside of the class declaration.
If this is an inline definition I would like to
write
<result-type> inline <class-name> ::
<function-name> ( <format-parameters> )
Unfortunately this only works if <result-type>
is a single identifier. Consider this example:
class C {
int F_simple_type();
int* F_inline_first();
int* F_split_type();
int* F_desired();
int X;
};
int inline C::
F_simple_type()
{
return X;
}
inline int* C::
F_inline_first()
{
return &X;
}
int inline *C::
F_split_type()
{
return &X;
}
int* inline C::
F_desired()
{
return &X;
}
F_simple_type shows that I can use my preferred
format when <result-type> is simple. F_inline_first
and F_split_type show syntaxes that are accepted by
the g++ 3.4.2 complier. But when I try use this
preferred format with a complex type (e.g. F_desired)
I get the errors:
error: expected unqualified-id before "inline"
error: expected init-declarator before "inline"
error: expected `,' or `;' before "inline"
Request to list:
----------------
Could someone who is familiar with the C++ standard
explain the logic that makes -- what for at least
some programmers is the clearest format -- invalid?
/john
--
John S. Yates, Jr. 508 665-6897 (voice)
Netezza Inc 508 665-6811 (fax)
200 Crossing Blvd. Framingham, MA 01701
reply other threads:[~2005-07-05 14:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F0CD2E5262214F44959AD6AF34ADA66E01D130EF@mail2.netezza.com \
--to=jyates@netezza.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).