• January 27, 2023, 11:06:28 pm

Author Topic: C++  (Read 13110 times)

K i n g o f K i n g s

  • Hero Member
  • *******
  • Posts: 2,945
C++
« on: August 17, 2010, 05:52:38 pm »
I plan on learning this language soon. My only background in programming is basic python and Linux terminal. I need a compiler and would love your advice and see guides you think i should look at.

In most countries selling harmful things like drugs is punishable. How come people can sell Microsoft software and go unpunished?
The Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it.
Going from Windows to Linux is like trading a glider for an F117.

DewG

  • Addict
  • *****
  • Posts: 172
Re: C++
« Reply #1 on: August 18, 2010, 03:40:26 am »
Google ftw?

Clan xwKx & Op WiSe@UsWesT
Clan pK@UsEasT

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #2 on: August 18, 2010, 08:34:02 am »
Learn C#.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

K i n g o f K i n g s

  • Hero Member
  • *******
  • Posts: 2,945
Re: C++
« Reply #3 on: August 18, 2010, 09:50:15 am »
Google ftw?
I am for all but the compilers too, I dont trust random downloads/programs.
Learn C#.
Care to explain why I should learn this first?

In most countries selling harmful things like drugs is punishable. How come people can sell Microsoft software and go unpunished?
The Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it.
Going from Windows to Linux is like trading a glider for an F117.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #4 on: August 18, 2010, 09:53:35 am »
C++ is a terrible, unsafe, and extremely complicated language. It is not worth the trouble.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

K i n g o f K i n g s

  • Hero Member
  • *******
  • Posts: 2,945
Re: C++
« Reply #5 on: August 18, 2010, 10:01:06 am »
C++ is a terrible, unsafe, and extremely complicated language. It is not worth the trouble.
many game design/programming companies require high knowledge of C++.

In most countries selling harmful things like drugs is punishable. How come people can sell Microsoft software and go unpunished?
The Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it.
Going from Windows to Linux is like trading a glider for an F117.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #6 on: August 18, 2010, 10:55:20 am »
False.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

K i n g o f K i n g s

  • Hero Member
  • *******
  • Posts: 2,945

In most countries selling harmful things like drugs is punishable. How come people can sell Microsoft software and go unpunished?
The Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it.
Going from Windows to Linux is like trading a glider for an F117.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #8 on: August 18, 2010, 11:59:46 am »
Why do you argue with me as if I am wrong? You could join the hundreds of thousands of startups out there which don't touch a line of C++. Like, you know, I did.

Besides, by the time you waste your time with C++, so that you learn a small slice of it, then get your degree in a CS or related field, technology will have largely moved on.

C++ is only in any kind of demand right now because of legacy tools and engines, but you could just as easily join a Gaming company which uses Xna which works on Windows, XBox 360, Surface, and Windows Phone 7 .. and make plenty of money doing so.

Learning for the present is a stupid idea, learn for the future, where technology is going to be, looks nothing like where it is at. C++ will die a slow, agonizing death, but it will die.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

K i n g o f K i n g s

  • Hero Member
  • *******
  • Posts: 2,945
Re: C++
« Reply #9 on: August 18, 2010, 01:36:29 pm »
another reason im interested in c++ is it is cross platform. (osx linux and windows)
Is xna?

In most countries selling harmful things like drugs is punishable. How come people can sell Microsoft software and go unpunished?
The Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it.
Going from Windows to Linux is like trading a glider for an F117.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #10 on: August 18, 2010, 01:58:14 pm »
No. Then again, neither is the game industry for the most part. C++ is only as cross platform as you make it to be. For example, most games (nearly all) use a DirectX C++ rendering engine, which is also not cross platform.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

ben_fb

  • Addict
  • *****
  • Posts: 246
Re: C++
« Reply #11 on: August 18, 2010, 02:00:52 pm »
Coders actually live a harsh and underpaid life. Don't get me wrong you can make good money... 50-70k a year even. However, the real money is in database and project management. This includes setting up and managing databases for large companies, and often working as a team in designing a large website.

Most companies that develop games are less interested in coders and more interested in graphic artist that are familiar with 3D design (such as maya). Graphic design alone is also a lower paying degree, but it's easy and fun work in my opinion.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #12 on: August 18, 2010, 02:04:39 pm »
The game industry as a whole is one of the most non-crossplatform entities you could come across. There's no money to be made on Gaming under Linux, maybe under OSX and Valve is trying, but no one knows how viable it is.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

K i n g o f K i n g s

  • Hero Member
  • *******
  • Posts: 2,945
Re: C++
« Reply #13 on: August 18, 2010, 02:35:01 pm »
Compared to the Linux market share, there is profit. There are few companies making good games for it.
@ ben
Earnings About this section

In May 2008, median annual wages of wage-and-salary computer applications software engineers were $85,430. The middle 50 percent earned between $67,790 and $104,870. The lowest 10 percent earned less than $53,720, and the highest 10 percent earned more than $128,870. Median annual wages in the industries employing the largest numbers of computer applications software engineers in May 2008 were as follows:

Professional and commercial equipment and supplies merchant wholesalers    $93,740
Software publishers    87,710
Management of companies and enterprises    85,990
Computer systems design and related services    84,610
Insurance carriers    80,370

In May 2008, median annual wages of wage-and-salary computer systems software engineers were $92,430. The middle 50 percent earned between $73,200 and $113,960. The lowest 10 percent earned less than $57,810, and the highest 10 percent earned more than $135,780. Median annual wages in the industries employing the largest numbers of computer systems software engineers in May 2008 were as follows:

Scientific research and development services    $102,090
Computer and peripheral equipment manufacturing    101,270
Software publishers    93,590
Navigational measuring electromedical and control instruments manufacturing    91,720
Computer systems design and related services    91,610

Median annual wages of wage-and-salary computer programmers were $69,620 in May 2008. The middle 50 percent earned between $52,640 and $89,720 a year. The lowest 10 percent earned less than $40,080, and the highest 10 percent earned more than $111,450. Median annual wages in the industries employing the largest numbers of computer programmers in May 2008 are shown below:

Software publishers    $81,780
Management of companies and enterprises    71,040
Computer systems design and related services    70,270
Employment services    70,070
Insurance carriers    69,790

According to the National Association of Colleges and Employers, starting salary offers for graduates with a bachelor’s degree in computer science averaged $61,407 in July 2009.
credits to http://www.bls.gov/oco/ocos303.htm

In most countries selling harmful things like drugs is punishable. How come people can sell Microsoft software and go unpunished?
The Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it.
Going from Windows to Linux is like trading a glider for an F117.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #14 on: August 18, 2010, 02:43:56 pm »
If you want to take the C++ risk, then do so. I didn't, and I still got my programming job.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

Jason

  • Addict
  • *****
  • Posts: 249
Re: C++
« Reply #15 on: August 18, 2010, 05:58:16 pm »
Just curious warrior, what do you do for a living. I'm interested :]

кηιgнтяι∂єя

  • Funny huh?
  • Hero Member
  • *******
  • Posts: 1,583
  • Clan RaGe
    • .::Clan RaGe::.
Re: C++
« Reply #16 on: August 18, 2010, 06:17:19 pm »
:d


warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #17 on: August 18, 2010, 06:22:45 pm »
I program for a living. Involving .NET, C#, AspNet, and sometimes Silverlight. Can't really say much more than that.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

Crux

  • Hero Member
  • *******
  • Posts: 850
Re: C++
« Reply #18 on: August 19, 2010, 08:26:49 am »
I've just been following this and I have a few questions. Sorry if I've missed something, but why is C# better than C++? I mean is C++ bad or just going to become outdated or is there just a reason you don't like it?
If you don't acknowledge your failures, you'll never fail. -Tobuscus

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #19 on: August 19, 2010, 08:53:17 am »
The language is unsafe. As in, it is very, ridiculously easy for you to screw up. Normally, I'm all for personal responsibility, but with the inherent complexity of object oriented code, the amount of buffer overflows, double deletes, and memory leaks, are ridiculous.

C# (and all .NET languages) are type safe and memory safe. This means that you are guaranteed to never get a buffer overflow, never get a double delete, and hardly ever leak memory (the only exception is dealing with inherently unmanaged resources like i/o, but C# has constructs to make it easier.) C# is a static language, so type safety is enforced at compile time.

Do you know how annoying it is to deal with memory leaks? Leaks because an exception occurred during execution, or a double delete because of a flaw in your design? Sure, they're avoidable on paper, but once you get into the guts of programming, in large scale apps, with tons of people, yeah, it kinda gets ridiculously hard to manage.

C++ can be relatively type safe, but not if you do any pointer arithmetic (which kinda defeats the purpose, might as well use C#). Plus, the different type of casting syntaxes are annoying.

C# compiles to an intermediate language before being converted to machine code. That means, C# programs run on x86, x64, ARM, etc.. using the same exact binary. The JIT (Just in Time compiler) compiles and caches C# programs as they are run. This means if your CPU has SSE4 and mine doesn't, your program will be automatically optimized for it, without me needing to write a single line of code.

C# has bounds checking on arrays, and instead of giving you a potentially dangerous (and exploitable) memory error, you get an exception which you can handle and keep going. C# is a relatively safe language.

Not to mention it's object oriented syntax is much cleaner, with support for Single Inheritance of base classes and Multiple Inheritance of interfaces. It also actually has interfaces, and has properties, and delegates/events, and Generics (though C++ Templates come close), and lambdas, and closures, and well, the list goes on.

C++ is just unnecessary for 99% of programming uses out there today. The future is in verified, type safe, memory safe languages.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

CoolNcalm

  • The Cool N Calm
  • Addict
  • *****
  • Posts: 169
  • Woop Woop
    • Cool Lounge
Re: C++
« Reply #20 on: August 19, 2010, 08:57:03 am »
i like prime's sincerity and honesty. I also have to say i took some classes 4 years ago to get an associates... c c+ c++ was in there.while it might not be the fortune 500 of the coding world today it seems to be standing the test of time. As well if c++ is what wants to be started out with, it can easily teach the coding styles of java and vb... aka the fundamentals of coding. I think most points of this topic are valid though. cC languages might die but so might the internet SOMEDAY..hell so might the world. Gaming industry is still alive and well so might be a good field no matter what ur doing there. other newer languages might MIGHT flurish or MIGHT die sonner then the C's

Our past teaches the future and this means looking at past codes seems to tell what works and what doesnt. that being said we can only see relitivly close future to see what newer coding styles might do. So my honest opinion...some sort of CS degree as far as my living area goes...would be the way to go because you would get a vast line up of different languages from vb to c's to newer stuff. as well as x86 stuff that incorporates c's.

like my opinion or not it is mine to have. And it is based on history i have learned and MY experiences.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #21 on: August 19, 2010, 09:20:13 am »
The problem with that, is that, maybe C# will die (it wont, but lets say it will), maybe Java will die (most used programming language on the planet, it also wont, but lets just say) .. the ideology that they both bring to the table, which is verifiable, type safe, memory safe, managed languages ... will not.

Unmanaged languages are going out of style, fast. Most new languages developed do not have the limitations that C++ inherently has. None of them.

It's also a given that in colleges they teach primarily the same two languages nearly everywhere: C++ and Java. That does not mean those are what you'll use, it is up to you, to learn the languages you deem useful, in your spare time. You don't know how many wannabe big shots I see trying to get into the industry merely because they survived 4 years and got a CS Bachelors degree, which is a worthless piece of paper.

Programming isn't something you cram into four years, it's something you learn by experience. Some things are only imprinted on you by failure, and no class room is going to teach you how to think like a programmer. They'll just make you memorize syntax, which is useless.

The trend is going towards these new waves of managed languages. If you don't learn them, then you will be at a severe disadvantage in the future. C++ has plunged, VB has plunged, C# is rising. Java has pretty much parity with C. Which is incredible.

And I disagree about C++ making you a better programmer in other languages. Absolutely untrue.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

pikachu

  • Administrator
  • Hero Member
  • *******
  • Posts: 3,344
Re: C++
« Reply #22 on: August 19, 2010, 03:23:02 pm »
i took some classes 4 years ago to get an associates... c c+ c++ was in there.

What the fuck is C+?  Your average grade?  Try again.

Back on topic:
C# is not the be-all-end-all of programming languages.  There are clearly times when you shouldn't, or simply cannot use C#.  Consider heavily real-time systems...or embedded microchips.  I still think it's important to learn C++ even if only to understand why you shouldn't use it.

Also, I don't like how C# doesn't allow inheritance of multiple abstract classes.  I don't like that a class must be referenced before a static constructor is called.  I definitely don't like that there's no Number class between Object and Single/Double/Int etc. in .NET's class hierarchy.  It's still a great language, but it definitely isn't perfect.

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #23 on: August 19, 2010, 04:20:01 pm »
C# is not the be-all-end-all of programming languages.  There are clearly times when you shouldn't, or simply cannot use C#.  Consider heavily real-time systems...or embedded microchips.

Well this is where the difference between the runtime and the language come into play. Maybe more appropriately, .NET as a runtime isn't suitable for embedded systems (arguable still, WP7 does great with it, but even smaller the .NET Microframework does an alright job elsewhere, and it's open source).

But you can still have verified safe C# at compile time without having a runtime. This is how Singularity works, Ahead of Time compiling instead of Just in Time compiling.

Quote
I still think it's important to learn C++ even if only to understand why you shouldn't use it.

Point very well taken. Agreed. Maybe later on your programming career, but C++ is likely to shy people away from programming before they invite them to program. That's a real issue, C++ at first glance is very overwhelming.

Quote
Also, I don't like how C# doesn't allow inheritance of multiple abstract classes.

It has to do with the diamond problem, and how MI is not used in 90% of scenarios, where multiple interface inheritance works. For the other 10%, Mixins via Extension Methods do most of the job. I wouldn't be surprised if .NET5 includes true mixin support.

Quote
I don't like that a class must be referenced before a static constructor is called.

This is a genuine limitation, but I'm not sure how big of a problem it is. Maybe if you want your objects completely, 100% self containing, but honestly, I'm not that bad of a purist. I don't mind having initializing subsystem in Program.cs

Quote
I definitely don't like that there's no Number class between Object and Single/Double/Int etc. in .NET's class hierarchy.  It's still a great language, but it definitely isn't perfect.

Again, a distinction should be made between .NET, and C#. However, this is solved in various ways:

The problem is that doing so would require boxing/unboxing. If you'd ever do (if myInt is INumeric) or something of the sort, you'd incur implicit boxing penalty costs. The solution to this was of course Generic type T which doesn't do boxing, but type constraints are limited by class type and not by signature.

So you can use C# 4.0's dynamic keyword to get dynamic typing, and tell the type system you're willing to use run time checking vs compile time. It removes the boxing, and simply throws a runtime exception if the operator on a type is invalid (because it's not a numeric valuetype, or because it doesn't implement overload add for example).

The other way is that you can probably do some ExpressionTree run time code compilation magic, but I've never done that before. Otherwise you could always do runtime reflection, since System.ValueType is either numeric, struct, or enum. Simply check that at runtime.

Dynamic seems to be one of the easiest solutions though.
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

warrior

  • Sr. Member
  • ******
  • Posts: 409
  • Jesus Christ.
Re: C++
« Reply #24 on: August 19, 2010, 04:50:28 pm »
Edit: The Numeric issue was interesting, so here's another solution using Expression Trees. There is no question C# is the most powerful language I've ever used.

Code: [Select]
class Program
    {
        static void Main(string[] args)
        {
            int a = 123;
            Program b = new Program();
            System.Console.WriteLine(Add<int, Program>(a, b));

            System.Console.ReadLine();
        }

        static K Add<K,V>(K a, V b)
        {
            ParameterExpression paramA = Expression.Parameter(typeof(K), "a"),
                paramB = Expression.Parameter(typeof(V), "b");

            BinaryExpression body = null;
            Func<K, V, K> add = null;

            try
            {
               body = Expression.Add(paramA, paramB);
               add = Expression.Lambda<Func<K, V, K>>(body, paramA, paramB).Compile();
            }
            catch (InvalidOperationException)
            {
                System.Console.WriteLine("Numbers were not numeric or did not implement the Add operator");
                return default(K);
            }

            return add(a, b);
        }
    }
In capitalist America, bank robs you.

Choosing to code in an unmanaged language/platform is like choosing a hotel where you have to clean your own room.

When C++ is your hammer, everything starts to look like your thumb

 

newBalance by DzinerStudio