This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++-concepts]


Andrew Sutton <andrew.n.sutton@gmail.com> writes:

| This is a kind of large patch. It provides support for parsing
| constraints, the new concept declaration specifier (with some
| semantics implemented), and the infrastructure for creating and
| comparing constraints.

See comments below.  Patch OK when the comments are addressed.

In general:
  * Check against cxx11 dialect, not cxx0x.

  * Any particular reason to use classes with operator() for the 
    parseers and the combinators?  GCC can inline indirect calls to
    functions with internal linkage.  That should cut down on the
    constructor boilerplates.  This particular change can be addressed
    after the commit.

| +
| +namespace {
| +// A helper function. Returns the object pointed to by P
| +// and sets P to NULL.
| +template<typename T>
| +inline T* take(T*& p)
| +{
| +  T* q = p;
| +  p = NULL;
| +  return q;
| +}
| +} // namespace
| +
| +

Call it 'release' -- following standard library terminology.

| +// Require that pointer P is non-null before returning.
| +template<typename T>
| +inline T*
| +require (T* p)
| +{
| +  gcc_assert (p);
| +  return p;
| +}

The name 'require' is too vague compared to the documentation; and also
too close to 'requires' when the later becomes a keyword in C++17, we
don't want to get confused.

Suggestion: nonnull_or_else? or assert_nonnull? or check_nonnull?
or validate?

| -  /* 1 spare bit */
| +  unsigned concept_p : 1;                  /* var or fn */
| +  /* 0 spare bit */
|  };

Hmm I don't understand the comment "var or fn".
If it is declared a concept, how can it it be a var?


-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]