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

  • Home
  • SEARCH
  • 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 7712367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:36:45+00:00 2026-06-01T01:36:45+00:00

I came across a piece of advise in stack overflow which mentions about When

  • 0

I came across a piece of advise in stack overflow which mentions about When to use and when not to user forward declaration .

I came across this :-

struct X;              // Forward declaration of X

void f1(X* px) {}      // Legal: can always use a pointer/reference
X f2(int);             // Legal: return value in function prototype
void f3(X);            // Legal: parameter in function prototype
void f4(X) {}          // ILLEGAL: *definitions* require complete types`

The last line Which says illegal will fail while compilation.

void f3(X); // Works perfectly fine 

So is it that all header files (.hh) are first scanned by compiler and then all
.cc file looked for syntax and symantics where we actually can define the
void f3(X); as after scanning through header files compiler will have idea
about X its member function and member

  • 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-01T01:36:46+00:00Added an answer on June 1, 2026 at 1:36 am

    The compiler doesn’t scan header files. All that happens is that the preprocessor copy-and-pastes the contents of a header file whenever a #include is encountered, before handing that source file to the compiler.

    So after the preprocessor has run, this example:

    foo.h

    ABC
    

    bar.c

    #include "foo.h"
    DEF
    

    simply becomes:

    ABC
    DEF
    

    and that is what the compiler itself operates on.

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

Sidebar

Related Questions

I came across a piece of code which looks like this: jQuery(function($) { $('#saySomething').click(function()
I came across a piece of code which uses #pragma comment(lib, libraryname). Why this
I came across this piece of code. It works, but is it not against
I came across a piece of software about a year ago which would emulate
I was look at somebody else's code and came across this piece of code
Came across this code: <?php require_once 'HTTP/Session/Container/DB.php'; $s = new HTTP_Session_Container_DB('mysql://user:password@localhost/db'); ini_get('session.auto_start') or session_start();
I came across a piece of code that is: for(i=((90.0E1,0x5A)<=(0x158,140.70E1)?(.28,3.45E2,0):(95.30E1,26.40E1)<=1.400E2?(1,this):(108.,0x227));i<length;i++) { // some other
So I came across a piece about the difference between jQuery's bind() and live()
What does the +\ operator do in Python? I came across this piece of
I came across this problem when referring a piece of JavaScript code: <a href="javascript:void(0);"><!--

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.