user2337284
user2337284

Reputation: 131

C++ struct definition with two names without :

I am deciphering someone else's c++ code which has the following struct definition (in an *.h file)

struct QD_API qd_real {
  double x[4];    /* The Components. */


  qd_real();
  qd_real(const char *s);
  qd_real(const dd_real &dd);
  qd_real(double d);
  qd_real(int i);
}

What does this code actually declare? I don't understand why there are two names after struct, not separated by :, thus this does not seem as an example of inheritance. I've looked around but did not find any help on such a weird usage.

Upvotes: 3

Views: 295

Answers (1)

user195488
user195488

Reputation:

I looked up the macro QD_API and it basically does nothing. It is there for decoration to indicate that the struct is a part of the QD_API.

#ifndef QD_API
#define QD_API /**/
#endif

See here: https://github.com/wilmerhenao/BFGS/blob/master/lib/qd/qd_config.h

Upvotes: 3

Related Questions