CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Join Date
    May 2009
    Posts
    2,413

    Re: Simple Question: Pointers as Arguments

    Quote Originally Posted by TheGreatCthulhu View Post
    P.S. I think the creation of C# was, in fact, influenced by Java.
    Many would rather have it that C# is a rip-off of Java.

    Back in 1995 when Java was introduced by Sun everybody was behind Java including Microsoft and Apple. Steven Jobs bragged that Apple would have the best Java on the planet while Microsoft actually had it.

    Then the relationship between Sun and Microsoft turned sour. The reason was that Microsoft wanted to tweak Java so that programs compiled with the Microsoft compiler would run on Windows only. This developed into an ugly legal war that ended with Microsoft dropping Java and later paying damages to Sun.

    Instead Microsoft came up with C# that initially was more or less a Java clone. But over the years lots of new features were introduced in C# unlike Java which pretty much stayed the same. So today they differ quite a lot apart from the fact that both are based on the same general principles.
    Last edited by nuzzle; February 20th, 2010 at 08:13 AM.

  2. #17
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Simple Question: Pointers as Arguments

    About multiple pointer declarations - I think I remember now I have read about it long time ago.
    Anyway, here's the source of confusion - this is from MSDN article called "Pointer types (C# Programming Guide) ":

    Code:
    int* p1, p2, p3;   // Ok
    int *p1, *p2, *p3;   // Invalid in C#
    What I don't like in the standard used by C++ is that a token *name has a different meaning in different contexts (it means "pointer" in a declaration, and "value pointed by" otherwise). It's not a major issue, but it can lead to some unnecessary confusion.

    To nuzzle:
    So the story behind Java and C# is a sort of a legal soap opera. Funny
    But C# turned out rather good, and I love it.

    P.S. Oh God, I just tried to CTRL+SPACE a word here.

  3. #18
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Simple Question: Pointers as Arguments

    One more thing: shouldn't karnavor's MyFunction(...) as it is defined in the first post also cause a memory leak? Once the function exits, the newly created data is lost; since, although the data is passed by reference, the pointer itself is passed by value, right?

  4. #19
    Join Date
    May 2009
    Posts
    2,413

    Re: Simple Question: Pointers as Arguments

    Quote Originally Posted by TheGreatCthulhu View Post
    To nuzzle:
    So the story behind Java and C# is a sort of a legal soap opera. Funny
    But C# turned out rather good, and I love it.
    For many it was a matter of life or death. This happened at the height of Microsoft bashing and Sun was considered the good white knight in shining armour standing up to Microsoft, the very incarnation of everything evil on earth. So when Sun took the money and made up with Microsoft emotions boiled over. Many just couldn't stand the sight of Scott McNeally shaking hands with Bill Gates, smiling as if they were longtime buddies. Some high-ranking Sun employees felt so betrayed they even left the company. I have a feeling this may have contributed substantially to Sun's downfall.

    Anyway, I prefer Java for the simple reason it's portable. C# is more advanced today but unfortunately it's limited to Windows. There's an interesting alternative to both Java and C# and that's C++/CLI. If it was ported to the Java VM it probably would be my favourite. C++/CLI basically is classic C++ with the "managed" features of Java and C# on top.

    Everything considered, my favourite is C++. Especially with Qt now licenced under LGPL and especially with the new features of the new standard coming soon.
    Last edited by nuzzle; February 20th, 2010 at 09:22 AM.

  5. #20
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Simple Question: Pointers as Arguments

    Quote Originally Posted by TheGreatCthulhu
    Interesting - although I don't like this standard (makes my reasoning fail, or at least seem awkward); but, this is well established, so it is certainly something for a programmer to bear in mind.
    It is mentioned in Stroustrup's answer to the FAQ: Is ``int* p;'' right or is ``int *p;'' right?
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  6. #21
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Simple Question: Pointers as Arguments

    Quote Originally Posted by nuzzle View Post
    Anyway, I prefer Java for the simple reason it's portable. C# is more advanced today but unfortunately it's limited to Windows.
    Well, there's Mono, but that's pretty much a hack to get .NET running on non-Windows systems, not true cross-platform capability.

    There's an interesting alternative to both Java and C# and that's C++/CLI. If it was ported to the Java VM it probably would be my favourite. C++/CLI basically is classic C++ with the "managed" features of Java and C# on top.
    That's surprising. Again, I haven't had reason to familiarize myself with .NET at all yet, but the general consensus seemed to be that C++/CLI was a kludged-together Frankenstein which does neither .NET nor native coding very well, while trying to do both.

  7. #22
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Simple Question: Pointers as Arguments

    Quote Originally Posted by laserlight View Post
    It is mentioned in Stroustrup's answer to the FAQ: Is ``int* p;'' right or is ``int *p;'' right?
    Thanks for that.
    Stroustrup's site is like a programmer's bible, everyone should have it bookmarked (Bjarne Stroustrup's homepage).

    I followed your link the day you posted it, but I didn't intend to write any new posts, however now I feel that I should share this, since novice programmers, but not just them, could greatly benefit from it. Especially C++ programmers.

    Quote Originally Posted by nuzzle View Post
    Everything considered, my favourite is C++. Especially [...] with the new features of the new standard coming soon.
    You mean C++0x?
    Interesting. Check out what Stroustrup says on the same site: "Surprisingly, C++0x feels like a new language".
    (Bjarne Stroustrup's C++0x FAQ: What do you think of C++0x?)
    Last edited by TheGreatCthulhu; February 21st, 2010 at 05:02 PM.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured