CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2002
    Posts
    224

    “Classic” books on C++/CLI

    Hello,


    Are there any “classic” books on C++/CLI?

    I am programming in C++ for several years.


    Thank you.
    ZDF

    What is good is twice as good if it's simple.
    "Make it simple" is a complex task.

  2. #2
    Join Date
    Aug 2005
    Posts
    198

    Re: “Classic” books on C++/CLI

    C++/CLI has only been out for a year and a half, but one good book, (especially if you're coming from a C# or Java background) is "Pro Visual C++ 2005 for C# Developers" by Dean Wills (Apress press).
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  3. #3
    Join Date
    Jun 2002
    Posts
    224

    Re: “Classic” books on C++/CLI

    David, thank you for your reply. Unfortunately I do not “speak” C#. I only “speak” C++. I must learn C++/CLI and I need a good book; I do not want to waste any time or money.
    ZDF

    What is good is twice as good if it's simple.
    "Make it simple" is a complex task.

  4. #4
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: “Classic” books on C++/CLI

    IMHO (as a professional developer for 30 years). Any C++ programmer looking to learn C++/CLI really NEEDS to learn a "pure" managed language first.

    The reason I say this is because the paradigm shift between unmanaged (classic) code and managed code is at least as big as the paradigm shift from "C" to "C++". Remember how long people were really developing "C++ compliant C code" rather than true OO applications?????

    That same happens to 95% of the people I have worked with (or professionally trained). It is very difficult to realize that "best practices" of conventional C++ are really very bad in a managed environment (and that many very good things in managed code look very bad to C++ programmers).

    In fact I have made it a habit to teach people VB.NET rather than C# when doing the migration, because the greater syntax difference helps to trigger the mind to think differently. Every C++ programmer can read C# (at least 90+ of it), and can write compilable C# code without much training. But the "bad" habits linger.

    A quick example. In C++ if you arte going to use an object multiple times, you will probably keep some type of reference to it for re-use. In managed code (regardless of the language) it is usually best to creaate/use/destroy/create/use/destroy/.... unless the object really needs to maintain state or is extremely expensive to create.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  5. #5
    Join Date
    Jun 2002
    Posts
    224

    Re: “Classic” books on C++/CLI

    Hello CPUWizard,

    You obviously are an experienced programmer. I have a big problem and maybe you can help me. We have to start a new project (windows/desktop/graphics). So far I have only used C++/MFC; I have no experience with C# or C++/CLI. I have read a few articles about C# and C++/CLI and I realize I do not know enough about these languages and yet I must quickly decide which one is suitable for this kind of application and start learn it. The application will be large (hundreds of thousand of lines) and will, probably, use large portions of a similar, but older, application written in C++/MFC.

    I have the feeling C++/CLI is a more suitable language... but don’t ask me why, maybe because of the below qoute (Bjarne Stroustrup's FAQ).


    Thank you.


    What do you think of C#?

    I have no comments on C# as a language. It will take a lot to persuade me that the world needs yet another proprietary language (YAPL). It will be especially hard to persuade me that it needs a language that is closely integrated with a specific proprietary operating system.
    If you want to write exclusively for the .Net platform, C# isn't the worst alternative, but remember that C++ is a strongly supported - though less strongly hyped - alternative on that platform.

    What do you think of C++/CLI?

    C++/CLI is a set of extensions to ISO C++ that provides an extremely complete "binding" of C++ to Microsoft's CLI (Common Language Infrastructure). It has been standardized by ECMA (ECMA-372). I am happy that it makes every feature of the CLI easily accessible from C++ and happy that C++/CLI is a far better language than its predecessor "Managed C++". However, I am less happy that C++/CLI achieves its goals by essentially augmenting C++ with a separate language feature for each feature of CLI (interfaces, properties, generics, pointers, inheritance, enumerations, and much, much more). This will be a major source of confusion (whatever anyone does or says). The wealth of new language facilities in C++/CLI compared to ISO Standard C++ tempts programmers to write non-portable code that (often invisibly) become intimately tied to Microsoft Windows.
    The CLI provides a set of interfaces (to system facilities) that are very different from traditional interfaces to operating system facilities and applications. In particular, these interfaces have semantics that cannot be completely or conveniently expressed in conventional programming languages. One way of describing CLI is as a (partial) "platform" or "virtual machine". It consists of a large set of language features (inheritance, methods, loop constructs, callback mechanisms, etc.), supporting a large set of foundation libraries (the BCL), plus an elaborate system of metadata. The CLI is sometimes described as "language neutral". However, a language that doesn't accept a large subset of these facilities cannot use even basic .Net facilities (or future Microsoft Windows facilities, assuming that Microsoft's plans don't change) and a language that cannot express all of these features cannot be used for the implementation of resources meant to be usable by other languages. Thus, CLI is "language neutral" only in the sense that every language must support all of the CLI features to be "first-class" on .Net.
    I prefer a binding to be a few primitives, expressible as simple function calls and simple data structures in any language, possibly encapsulated in language-specific libraries. For the CLI, this can at best be done for consumers of CLI facilities only. A language used to produce CLI modules must be able to express all of the CLI facilities, including the metadata. Only a language that can do that can be considered a systems programming language on .Net. Thus, the Microsoft C++ team concluded that only build-in language facilities are acceptable to their customers. Their design reflects a view that accepts absolutely no restrictions on what part of CLI can be expressed in C++ with the C++/CLI extensions, absolutely no verbosity compared to other languages when using CLI facilities, and absolutely no overheads compared to other languages. They aim at preserving C++ as the dominant systems programming language for Windows.
    As ever, I place a heavy emphasis on portability and recommend people to design applications so that access to system-specific facilities are through well-defined interfaces specified in ISO C++ (e.g., not to use C++/CLI directly). On Windows, this will sometimes be inconvenient compared with using C++/CLI facilities directly, but it's the only way to gain portability and a degree of vendor independence. Obviously, that arms-length approach to the CLI cannot be maintained if the purpose of a piece of code is to provide a CLI interface to be consumed by other code. Please note that I recognize the need for system-specific extensions and that Microsoft is not the only C++ vendor with such extensions, I just strongly prefer to deal with such extensions though a "thin interface" specified in ISO standard C++.
    How to deal with system-specific extensions is inherently a difficult question. The Microsoft C++ team, especially Herb Sutter, has kept up an active dialog with (other) members of the ISO C++ standards committee so that the relationship between ISO C++ and its superset C++/CLI will eventually be worked out. We have a long record of constructive joint work in the ISO C++ committee. Also, to minimize confusion between ISO C++ and the C++/CLI extensions, Microsoft is now revising their Visual C++ documentation to try to clearly distinguish C++/CLI from ISO C++ (plain unqualified C++ means ISO C++). I hope others will follow that lead.
    On the difficult and controversial question of what the CLI binding/extensions to C++ is to be called, I prefer C++/CLI as a shorthand for "The CLI extensions to ISO C++". Keeping C++ as part of the name reminds people what is the base language and will help keep C++ a proper subset of C++ with the C++/CLI extensions. The C/C++ compatibility problems demonstrate how important it is to keep that subset property.
    ZDF

    What is good is twice as good if it's simple.
    "Make it simple" is a complex task.

  6. #6
    Join Date
    Aug 2002
    Location
    Kerala
    Posts
    1,183

    Re: “Classic” books on C++/CLI

    Quote Originally Posted by zdf
    We have to start a new project (windows/desktop/graphics) .... I must quickly decide which one is suitable for this kind of application and start learn it. The application will be large (hundreds of thousand of lines) and will, probably, use large portions of a similar, but older, application written in C++/MFC.
    If you think you will be doing a lot of mixed mode (managed / unmanaged) programming the best choice is C++ . If the whole thing can be managed in managed code, then, like CPUWizard said, doing it in VB.NET can help you absorb the shock of the paradigm shift.

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