CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 56
  1. #16
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: C++ Aha! Moments

    Quote Originally Posted by Zaccheus
    Or if you have been struggling with a problem and then read something helpful in a book!
    IMO that's more an "Oh! Of course!".

    - petter

  2. #17
    Join Date
    May 2005
    Posts
    4,954

    Re: C++ Aha! Moments

    Here are few:
    • Discovering references.
    • Discovering STL.
    • Discovering RTTI (took some time to find out I need to check the RTTI check box in the compiler but after that it was ok )
    • Last one that is not related to C++ but more to Win Api is that I am always amazed that no matter what you need to do there is an api that does it, sometimes the name can be misleading so its hard to find them but believe me its exists and it “there”.


    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #18
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: C++ Aha! Moments

    Quote Originally Posted by wildfrog
    IMO that's more an "Oh! Of course!".

    - petter
    Sometimes, yes.
    My hobby projects:
    www.rclsoftware.org.uk

  4. #19
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: C++ Aha! Moments

    My Aha ! moment was when I finally sat down with C# and stopped being so prejudiced, thinking it was just VB6 with a C++ syntax. I've never looked back...

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  5. #20
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: C++ Aha! Moments

    C# is a good language.
    My hobby projects:
    www.rclsoftware.org.uk

  6. #21
    Join Date
    Feb 2005
    Location
    Normandy in France
    Posts
    4,590

    Re: C++ Aha! Moments

    My Aha list (I can't remember dates, my brain is really not designed for that) in an approximatively chronological order:
    • Constructors, destructors & RAII (I didn't know the term at this date).
    • Multiple inheritance.
      My C++ teacher in DEUG 2 (I had 4 months of C++ taught at university, though STL or dynamic memory allocation were not introduced in these courses) told me that a class could not inherit from more than one class when I asked whether it was possible (after all, a thing can be more than the expression of a single abstraction at a time). I trusted him, until I discovered that he was wrong later.
    • streambuf and its role in iostreams.
      I discovered that this design allows an indefinite extensibility of the number of streambufs, without any depency on iostreams classes, and permits an extensibility of the iostream classes without any modification of streambuf classes.
      It's even easy to create new iostream-like classes based on a streambuf* pointer.

      And the streambuf class is designed for extreme speed (no virtual function call for sputc or sgetc), even though its power is not diminished by this design choice.

      The only pain with streambuf are the incredibely ugly and inconsistent member names.
    • Pointer to members (data members as well as function members).
      Even though it's not a feature used everyday, it's representative of the freedom that C++ gives to programmers. From this date, I have feeled very friendly with C++.
    • Templates & template meta-programming.
      Very impressive.
    • Understanding really the concepts behind C++ types & scope rules.
      Reference types can be used almost anywhere (e.g. members, return value), and not only as function parameters.
      Function types can be typedefed, and exists on they own.
      You can create pointers to array, references to array, references to functions...
      You can declare external linkage functions & data in any block of code.
      Code:
      typedef int intOperator(int x,int y);
      
      int main() {
        intOperator add, sub, multiply, divide;
        return multiply(2,add(5,3));
      }
      int add(int x,int y)
      {
      return x+y;
      }
      int multiply(int x, int y)
      {
      return x*y;
      }
    • The iterator abstraction that I discovered with the STL. The "Aha" applied to the abstraction of iterators, not really to the STL containers themselves.
    • Private inheritance.
    • Exception correctness, reading Herb Sutter's GotW. Very impressive. A new way of thinking & programming.
      Deeper understanding of the roles of swap, RAII and exception guarantees.
    "inherit to be reused by code that uses the base class, not to reuse base class code", Sutter and Alexandrescu, C++ Coding Standards.
    Club of lovers of the C++ typecasts cute syntax: Only recorded member.

    Out of memory happens! Handle it properly!
    Say no to g_new()!

  7. #22
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++ Aha! Moments

    What a great discussion here. Let me join with 5 C++ Aha! moments, in a chronological order
    • discovering C++ programs written for Borland C++ 3.1 don't run in VisualC++, especially if they use headers like <graphics.h> or <dos.h>. (2001)
    • discovering in C++ structs can have member functions; I used to thought of structs in the C way, and I was quite surprized that nobody told me in college what structs in C++ really are; (2002)
    • discovering pointer this is not a member of a class but a parameter to the non-static member functions; I almost felt betrayed, it made me wonder what good for were my university studies; I always lived with the impression, that pointer this is some special default member of classes. This was probably my greatest revelation. Suddenly, the C++ releaveled to me in a different light. (2003)
    • discovering STL and especially std::vector and std::string; it really made my programs look totally different. Discovering how nice functors are also came as I was starting to use STL. (2005)
    • realizing that CPP was the most suitable 3-characters combination that would define me so that I could put on my car's identification plate. That made a lot of people laught. (2006)
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  8. #23
    Join Date
    Mar 2004
    Location
    Ukraine
    Posts
    170

    Re: C++ Aha! Moments

    1) 2004 understanding that class`s may have ancestors
    2) 2004 getting idea about functions overlaoding
    3) 2005 at last I have understand why we need virtual functions
    God could improve essentially a
    human nature, but he
    was too anxious with compatibility
    with the monkey.
    (Eugeny Goldberg)

  9. #24
    Join Date
    Apr 1999
    Location
    Altrincham, England
    Posts
    4,470

    Re: C++ Aha! Moments

    Quote Originally Posted by cilu
    • discovering pointer this is not a member of a class but a parameter to the non-static member functions; I almost felt betrayed, it made me wonder what good for were my university studies; I always lived with the impression, that pointer this is some special default member of classes. This was probably my greatest revelation. Suddenly, the C++ releaveled to me in a different light. (2003)
    And that "const" at the end of a function signature actually makes sense...
    Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
    --
    Sutter and Alexandrescu, C++ Coding Standards

    Programs must be written for people to read, and only incidentally for machines to execute.

    --
    Harold Abelson and Gerald Jay Sussman

    The cheapest, fastest and most reliable components of a computer system are those that aren't there.
    -- Gordon Bell


  10. #25
    Join Date
    Apr 1999
    Posts
    27,449

    Re: C++ Aha! Moments

    I was coding in 'C' before taking up C++ 16 years ago. So here is my contribution.
    • Discovering that C++ isn't just 'C' with some extra syntax.
    • Using STL for the first time, and realizing I didn't need to code all of those data structures, string classes, and algorithms again from scratch.
    • Templates and meta-programming.
    • gcc is not a toy compiler.

    Regards,

    Paul McKenzie

  11. #26
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: C++ Aha! Moments

    Quote Originally Posted by cilu
    • realizing that CPP was the most suitable 3-characters combination that would define me so that I could put on my car's identification plate. That made a lot of people laught. (2006)
    Next, you should try MFC...
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  12. #27
    Join Date
    Oct 2005
    Location
    England
    Posts
    803

    Re: C++ Aha! Moments

    when the the message I sent with winsock actually got the the other end .
    Rich

    Visual Studio 2010 Professional | Windows 7 (x64)
    Ubuntu

  13. #28
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++ Aha! Moments

    Quote Originally Posted by Graham
    And that "const" at the end of a function signature actually makes sense...
    Yes, of course. It makes a lot of sense.

    Quote Originally Posted by ovidiu
    Next, you should try MFC...
    Yes, but MFC is written in C++, so...
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  14. #29
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: C++ Aha! Moments

    I would like to rectify this item:
    Quote Originally Posted by me
    Aha...
    • ... Windows API is something cool! Death to console applications!
    Better sounds:
    Aha...
    • ... "WinMain" is for making applications; "main" is for teaching teachers.

    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  15. #30
    Join Date
    Apr 2003
    Location
    kathmandu, nepal
    Posts
    1,570

    Re: C++ Aha! Moments

    1. Discovering CG. Besides the emotional attachements, CG got me my first US$ earning job through the "Looking for Job" forum. The client happended to browse CG and had contacted me.

    2. Discovering MFC. Actually I learned C++ through MFC. My father's friend had by accidently left the book "Mastering Visual C++ 6.0" by Michael J. Young in my house. Thinking that he would be back for the book any time I literally copied the whole book (more than 1000 pages) by hand. I even copied the code listings. But the friend didn't ask for that book. I still have the book and also the hand copied version. It's hard to believe but this is true.

    3. Understanding virtual functions, pointers and references.

    4. Understanding copy constructors.

    5. Dynamic casts

    6. Knowing the usefulness of Design Patterns.

    7. Recently upon being stumbled with "Modern C++ Design" and understanding the usefulness of Policies.
    If there is no love sun won't shine

Page 2 of 4 FirstFirst 1234 LastLast

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