Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7849211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:27:05+00:00 2026-06-02T18:27:05+00:00

How is this statement a definition? Isn’t it supposed to be a declaration only

  • 0

How is this statement a definition? Isn’t it supposed to be a declaration only as it does not allocate any memory until we define an object of the type struct date?

struct Date { int d , m , y ; };

I am readng this book called “The C++ programming language” by Bjarne Stroustrup, in which it has been said (in section 4.9) that this a declaration as well as a definition.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:27:08+00:00Added an answer on June 2, 2026 at 6:27 pm

    It’s not a statement in either language. C99 defines statements in 6.8, and C++11 defines statements in 6.

    In C, it is not a definition, it’s a declaration only: 6.7/5 of C99 says:

    A definition of an identifier is a declaration for that identifier that:
    —for an object, causes storage to be reserved for that object;
    —for a function, includes the function body;
    —for an enumeration constant or typedef name, is the (only) declaration of the identifier.

    Since this is none of those three things, it’s not a definition of an identifier. In the C99 grammar, it’s a struct-or-union-specifier (followed by a semi-colon), which in turn is a type-specifier (followed by a semi-colon), which is one of the permitted forms of a declaration (6.7/1).

    In C++, it is a class-specifier or class definition: 9/2 of C++11 says

    A class-specifier is commonly referred to as a class definition.

    In both C and C++ it’s common to say that “every definition is a declaration”, so that’s probably why Stroustrup say’s it’s a declaration as well as a definition.

    In C this is strictly true, because of the definition of “definition” above. In C++ I think it’s not actually true in the grammar that a class-specifier is a declaration, but a class definition introduces a complete type, while a class declaration introduces an incomplete type. There’s nothing you can do with an incomplete type that you can’t also do with the complete type, so the class definition is “as good as” a class declaration like struct Date;, and better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this statement, taken from the Pagerank source code: Pattern.compile(\\[.+?\\]); What does the pattern
Or: What is not a T-SQL statement? Except to resolve ambiguity, T-SQL syntax does
This isn't exactly the definition of implicit type conversion, but I'm curious how many
I have the following error message: 'System.Collections.Generic.Dictionary<int,SpoofClass>' does not contain a definition for 'biff'
This is the statement from ISO C++ Standard 14.6/6: Within the definition of a
This is the statement from ISO C++ Standard 14.6/8: When looking for the declaration
I keep getting a memory leak indication from this sql statement when I assign
If I say: x = abc this seems like a declaration, definition and assignment,
this statement will generate a 4 column table: SELECT shipped.badguy AS badguy, shipped.sdate AS
This statement doesnot work in Entity Framework context.sleep.Where(o=>o.clientDateTime.TimeOfDay>new TimeSpan(18,0,0)).ToList(); Please suggest me a workaround.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.