Pointer argument differences in C versus C++

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 781 Views - Last Post: 31 July 2013 - 06:17 PM Rate Topic: -----

#16 jimblumberg  Icon User is online

  • member icon


Reputation: 3993
  • View blog
  • Posts: 12,322
  • Joined: 25-December 09

Re: Pointer argument differences in C versus C++

Posted 31 July 2013 - 04:01 PM

I used gcc 4.7.3 and since the C compiler you seem to be using doesn't have most error warning messages enabled you won't see very much.

I really suggest you think about downloading and installing a local compiler that you will have more control over. Something like code::blocks would be a good choice if you happen to want to compile both C and C++ programs.

Jim
Was This Post Helpful? 1
  • +
  • -

#17 jimblumberg  Icon User is online

  • member icon


Reputation: 3993
  • View blog
  • Posts: 12,322
  • Joined: 25-December 09

Re: Pointer argument differences in C versus C++

Posted 31 July 2013 - 04:10 PM

Quote

Okay so it must be compiler dependent. Now, there is another question: is this acceptable behavior to allow the passing of an address to a function accepting a pointer?


You should be getting a waring message, never ignore your warnings. These warnings are a sure sign of trouble. And always insure you have your compiler warning messages enabled. As it is I wouldn't recommend using the Codepad compiler for a C program with it's lack of warnings. Unless and until you can increase the warning levels I'd stick to C++ with that compiler.

Jim
Was This Post Helpful? 2
  • +
  • -

#18 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Pointer argument differences in C versus C++

Posted 31 July 2013 - 06:12 PM

View Postjimblumberg, on 31 July 2013 - 04:01 PM, said:

I used gcc 4.7.3 and since the C compiler you seem to be using doesn't have most error warning messages enabled you won't see very much.

I really suggest you think about downloading and installing a local compiler that you will have more control over. Something like code::blocks would be a good choice if you happen to want to compile both C and C++ programs.

Jim


Okay I have actually used code::blocks before. As of right now, I have multiple ides (wxDevCpp, netbeans, VC++ ...)on my computer that I use. I might install code::blocks anyway thought. Thanks for the suggestion.
Was This Post Helpful? 0
  • +
  • -

#19 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Pointer argument differences in C versus C++

Posted 31 July 2013 - 06:17 PM

View Postjimblumberg, on 31 July 2013 - 04:10 PM, said:

Quote

Okay so it must be compiler dependent. Now, there is another question: is this acceptable behavior to allow the passing of an address to a function accepting a pointer?


You should be getting a waring message, never ignore your warnings. These warnings are a sure sign of trouble. And always insure you have your compiler warning messages enabled. As it is I wouldn't recommend using the Codepad compiler for a C program with it's lack of warnings. Unless and until you can increase the warning levels I'd stick to C++ with that compiler.

Jim


So the reason why it didn't catch it was because it didn't have as strict warning flags, okay, got it. I should just stick to codepad for just little toy and experimentation programs, I guess.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2