Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. &

&

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    albean
    wrote on last edited by
    #1

    Is there a difference between this: bool foo(int& a); and this: bool foo(int &a); Thanks.

    D M 2 Replies Last reply
    0
    • A albean

      Is there a difference between this: bool foo(int& a); and this: bool foo(int &a); Thanks.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      To you, the preprocessor, or the compiler? Where you put spaces, and how many you put, is irrelevant to the compiler as the preprocessor removes them all before sending the tokens to the compiler. Take something like:

      #include < stdio.h >

      int main( int argc, char **argv )
      {
      printf("Hello World!\n");
      return 0;
      }

      You could have just as easily written it as: #include < stdio.h >int main( int argc, char **argv ){printf("Hello World!\n");return 0;} The compiler wouldn't have cared.

      1 Reply Last reply
      0
      • A albean

        Is there a difference between this: bool foo(int& a); and this: bool foo(int &a); Thanks.

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        No, however int& is preferable because it makes it clear that the type of "a" is "int&" Yes, you can start a religious argument over this issue. I don't care. I'm right. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me

        A 1 Reply Last reply
        0
        • M Michael Dunn

          No, however int& is preferable because it makes it clear that the type of "a" is "int&" Yes, you can start a religious argument over this issue. I don't care. I'm right. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me

          A Offline
          A Offline
          Atlantys
          wrote on last edited by
          #4

          Michael Dunn wrote: Ericahist Excellent! I've finally been able to increase my "Pictures of Erica" collection from a measy two to....six. w00t! I suppose six is better than nothing though! :-D Thanks! (been an Erica fan since back the GoogleFight of Erica (yeah!) vs Britney (boo! hiss!)) <insert link to the aforementioned post> :-D I prefer to wear gloves when using it, but that's merely a matter of personal hygiene [Roger Wright on VB] Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. [Rich Cook]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups