Visual Studio C++ no longer actually C++

by ,

Read this today in the
on OSNews:

C++/CLI also streamlines the manner in which managed data types are defined and consumed. The new standard introduces keywords that are more intuitive to C++ developers than the underbar-underbar keywords of current Managed Extensions. In C++/CLI, the ref keyword is used in a manner similar to the Managed Extensions __gc keyword to define a garbage-collected class:

   ref class MyRefClass { /* ... */ };

In addition, C++/CLI introduces a new category of type, the handle, which is used to signify the use of automatic garbage collection. Handles borrow the syntax of pointers, but use the carat (^) in place of the asterisk (*). The keyword gcnew is used to create these garbage collected objects, and returns a handle:

   MyRefClass ^ c = gcnew MyRefClass();

So, great, they’ve added a new pointer-like type called the handle. And you declare it with the “^” character. Um, okay. Now, how do I use it? Can I say c->field? Maybe they’ve added the # character to act in the same way as ->? Then we get c#field!

Whatever this is, it’s not C++.


About rae

I'm a long-time Mac and iOS developer. I'm also a big fan of Ruby on Rails and relational databases. I tend to work remotely, in my basement with occasional trips to the office. I'm also a big videophile, both TV and film, and can't wait for a good, inexpensive home 4k solution.

8 comments on “Visual Studio C++ no longer actually C++

  1. Jeff K

    Speaking of languages, the PERL 5.8.1 that ships with Fedora is pretty buggy. I managed seg-faults and hashes that didn’t clean themselves as well as arrays magically becoming 1 element longer than they should be. [As well as learning at least a dozen PERL mis-features the hard way like undef @a not setting $#a to -1, “my $debug” acting globally etc.] At least 2 people have tried to convince me to learn C# recently. Garbage collection is the root of all evil.

  2. Reid Ellis

    Yow, that’s pretty bad! Did you file bug reports? Is there a newer version of Perl? What is the output of “perl -V”? Mac OS X is also running Perl 5.8.1 (RC3). Here’s an abbreviated version of my otuput from “perl -V”:

    Summary of my perl5 (revision 5.0 version 8 subversion 1 RC3) configuration:
    osname=darwin, osvers=7.0, archname=darwin-thread-multi-2level
    uname=’darwin hampsten 7.0 darwin kernel version 6.0: fri jul 25 16:58:41 pdt 2003; root:xnu-344.frankd.rootsxnu-344.frankd~objrelease_ppc power macintosh powerpc ‘
    config_args=’-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib’
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef

    Characteristics of this binary (from libperl):
    Locally applied patches:
    Built under darwin
    Compiled at Sep 12 2003 19:50:49

  3. Jeff K

    Perl is good for small things. I remember years ago when I was writing PERL programs to teach me Scrabble tricks, it worked okay as a prototyping language, but the hashes have tremendous overhead, so I eventually re-coded the Scrabble-aid/teacher/tester program in Win32/WinCE (MFC C++). I haven’t used the PERL version of it since, although these days I don’t think 4Meg wasted on a dictionary hash that should take 200K would worry anyone. (I ran 5.8.3 & 5.9.1 with the same seg-faults). Ah well, some progs just need to be written in C++. I’ll just have to have a mother-PERL program controlling the C++ somehow.

  4. Jeff K

    90% of the Scrabble teacher was MFC GUI. Since it ran on a PDA, the dictionaries could be binary-searched from the compact-flash files themselves in micro-seconds so I didn’t even load it into “program memory” — no STL collections were needed, but don’t tell John I didn’t use a “dawg” (a type of collection useful for dictionaries).

  5. Jeff K

    Grasshopper, do not read too much into my motives. I set out to learn WinCE with that program [I had already written versions in Perl-Tk (to learn Perl-Tk) & some proprietary Telxon screen library (to learn Penright, as they called it) prior to porting it to WinCE, but certainly most of the new development went into the WinCE program].

  6. Reid Ellis

    Heh heh heh. Ah, okay. I understand Master. 🙂

    But surely the “guts” of the code could be platform-neutral, while the code that dealt with the UI etc could be more API-specific. But then again, if it’s just fast-and-dirty throwaway code, it doesn’t matter.

Leave a Reply

Your email address will not be published. Required fields are marked *