Advertising (This ad goes away for registered users. You can Login or Register)

Why is everyone scared of C++?

Open discussions on programming specifically for the PS Vita.
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
hgoel0974
Retired Mod
Posts: 2155
Joined: Mon Jul 23, 2012 11:42 pm
Location: New York

Re: Why is everyone scared of C++?

Post by hgoel0974 »

People not using C++ doesn't mean they're scared of it....

I don't bother with C++ most of the time because I don't need it, if I can just as easily get the job done in C, why would i bother with C++?

Also, OOP style code can be written in C too, it'd just require a struct to represent the object state.
By the way, C is actually rather simple (ignoring the entire standard library), C++ is rather complex (compiler wise), but I don't see how one could make any meaningful comparisons regarding language complexity since all popular programming languages can do everything.

Personally, sublime text for code with build scripts and make files from a terminal ftw (emacs sux ;) )
Advertising
"If the truth is a cruel mistress, then a lie must be a nice girl"
CPUzX
Moderator
Posts: 276
Joined: Thu Nov 28, 2013 8:25 pm
Location: United Kingdom

Re: Why is everyone scared of C++?

Post by CPUzX »

hgoel0974 wrote:People not using C++ doesn't mean they're scared of it....

I don't bother with C++ most of the time because I don't need it, if I can just as easily get the job done in C, why would i bother with C++?

Also, OOP style code can be written in C too, it'd just require a struct to represent the object state.
By the way, C is actually rather simple (ignoring the entire standard library), C++ is rather complex (compiler wise), but I don't see how one could make any meaningful comparisons regarding language complexity since all popular programming languages can do everything.

Personally, sublime text for code with build scripts and make files from a terminal ftw (emacs sux ;) )
I see from various sources that a lot of the time, they say that C is one of the most versatile programming languages that has some of the most advanced and some of the most powerful advantages in it that most other languages struggle to achieve or even complete. LUA is one that is supposed to be very lightweight, but not very powerful, but the same is said with java & html not being capable of doing certain things C does, but at the same time, isn't HTML supposed to be strictly for web based programming and LUA strictly for scripting?
That's the differences that are visible from my side.
C is a very complex language as it seems, but python also appears to be very advanced...
Advertising
Gringo466
Posts: 78
Joined: Fri Feb 13, 2015 3:31 am

Re: Why is everyone scared of C++?

Post by Gringo466 »

i have code blocks setup using vitaSDK i will post a copy once soon. i seen too many people asking about one.. i will also post a sample project (and yes it will be portable, also with full code completion)
hgoel0974
Retired Mod
Posts: 2155
Joined: Mon Jul 23, 2012 11:42 pm
Location: New York

Re: Why is everyone scared of C++?

Post by hgoel0974 »

CPUzX wrote: I see from various sources that a lot of the time, they say that C is one of the most versatile programming languages that has some of the most advanced and some of the most powerful advantages in it that most other languages struggle to achieve or even complete. LUA is one that is supposed to be very lightweight, but not very powerful, but the same is said with java & html not being capable of doing certain things C does, but at the same time, isn't HTML supposed to be strictly for web based programming and LUA strictly for scripting?
That's the differences that are visible from my side.
C is a very complex language as it seems, but python also appears to be very advanced...
Ah, yes, that is true. Essentially, C can be seen as a higher level, machine independent wrapper on assembly, which means it can use things like inline assembly or directly call a function written in assembly. This makes it very useful for things like writing operating systems or other low level code. This also means that once you can compile it for a certain architecture, you are practically guaranteed to be able to use the language features it provides. In comparison, C++, C#, Java, Lua and Python all require some sort of runtime to be able to use all the features of the language. This means that you can't be as close to the hardware (Except with C++, but that's a special case since it's meant to be compatible with C). So you lose some functionality that would require explicit knowledge about the hardware (like perhaps knowing about the architecture it's running on).

HTML's status as a programming language is somewhat debatable, I personally don't think of it as one. LUA is not necessarily for scripting, but that is its primary function, it's lightweight enough to interpret quickly and can easily be extended, thus it is popular in applications that need some quick scripting functionality (for instance, game engines)
"If the truth is a cruel mistress, then a lie must be a nice girl"
CPUzX
Moderator
Posts: 276
Joined: Thu Nov 28, 2013 8:25 pm
Location: United Kingdom

Re: Why is everyone scared of C++?

Post by CPUzX »

hgoel0974 wrote:
CPUzX wrote: I see from various sources that a lot of the time, they say that C is one of the most versatile programming languages that has some of the most advanced and some of the most powerful advantages in it that most other languages struggle to achieve or even complete. LUA is one that is supposed to be very lightweight, but not very powerful, but the same is said with java & html not being capable of doing certain things C does, but at the same time, isn't HTML supposed to be strictly for web based programming and LUA strictly for scripting?
That's the differences that are visible from my side.
C is a very complex language as it seems, but python also appears to be very advanced...
Ah, yes, that is true. Essentially, C can be seen as a higher level, machine independent wrapper on assembly, which means it can use things like inline assembly or directly call a function written in assembly. This makes it very useful for things like writing operating systems or other low level code. This also means that once you can compile it for a certain architecture, you are practically guaranteed to be able to use the language features it provides. In comparison, C++, C#, Java, Lua and Python all require some sort of runtime to be able to use all the features of the language. This means that you can't be as close to the hardware (Except with C++, but that's a special case since it's meant to be compatible with C). So you lose some functionality that would require explicit knowledge about the hardware (like perhaps knowing about the architecture it's running on).

HTML's status as a programming language is somewhat debatable, I personally don't think of it as one. LUA is not necessarily for scripting, but that is its primary function, it's lightweight enough to interpret quickly and can easily be extended, thus it is popular in applications that need some quick scripting functionality (for instance, game engines)
Thanks for specifying the differences!
Right now it's a little confusing. I haven't read much into the pdf that fate6 recommended: Sams Teach Yourself C, but it's been very informative so far.
Think I understand more about the runtime environment now to be able to comprehend what it is. That actually makes sense. In that case, it seems as if C really is the best language to start off learning. C++ seems to be on a whole other level.
It's LUA that I've seen the most when it comes to hexadecimal code or cheat engine variables/strings and when modifying a game's files, but that explains it being lightweight. Awesome.
Think I'll be sticking to learning C from now on; rather than going back to Python, or attempting to comprehend the whole homebrew/exploit side of the Vita. Thanks for the explanation!
PureIso
Posts: 9
Joined: Tue Sep 13, 2016 12:35 pm

Re: Why is everyone scared of C++?

Post by PureIso »

For IDE I recommend code block or Clion which I am using.
n00b81
HBL Collaborator
Posts: 31
Joined: Sat Oct 09, 2010 6:39 pm

Re: Why is everyone scared of C++?

Post by n00b81 »

I don't think its that individuals are necessarily "scared of C++" but more that they want to stray away from it and/or can't be bothered with it.

In general, typically when people are coding something, their intent is to complete the task fairly quickly as well. There are a myriad of languages these days that have built-in support that would allow you to do this for nearly every task. For instance, if you asked someone to write a quick app to sort through data and pull whatever important data out of it that you required - they'd probably go right to a language like python or ruby, etc. C++ would most likely be kind of "last on the list" of languages that would pop into their heads in terms of meeting at that intersection of getting the task done and getting it done in a reasonable amount of time. (This of course can vary by person a bit - if you have someone who's just coded in C++ every day of their lives then they'll probably still be able to do this faster in C++ than in anything else).

This reasoning will of course flip during times when there really just isn't any other good alternative to C++. For instance, coding a "Call of Duty" type game with lua is just kinda... a bad idea :P At the same time though - OOP fits game design nicely, which would rule strictly using C out in many cases - which leads to C++.

So yeah, at least from what I've seen - in most cases its probably less "scared" and more "can't be bothered" with C++ (and any language in general).

That all being said, I know a few recruiters who have told me that many corporations are using C++ and QT for UI apps (when they do decide to go with C++). So anyone looking to develop new marketable skills might want to try sharpening those skills a bit :)
romain337
Posts: 219
Joined: Wed Feb 29, 2012 10:42 am
Location: France
Contact:

Re: Why is everyone scared of C++?

Post by romain337 »

Since some day at work I have to code in another language than Java for Android, and that actually scare me.

So far, I tested 2 multi platform "language" (if I can say) in the last few weeks.

React-Native:
Seem cool to make web app but If you think it's quick and easy to make a cross platform app (ios+android) with it, you must know the both OS in the native side (Java android+ObjectiveC ios) AND the React framework. It's not that simple to have a single entry point and be compatible to both ios and android. The 2 platform use some libs that are tied to their OS so to make all work ok in the end you will have to write platform specific code, that can be an headache at some point.
Of course, knowing javascript is a must... because you do not have inline help and the goods (maybe using some dedicated IDE, but both nuclide and vscode barrely helps in this side).

The second is making a game using libgdx and roboVM/roboPODS.
This is my second nightmare. I've made a simple "dodge" game compatible with Ios, Android, HTML and Desktop. Implementing the game using libgdx is pretty neat, that's a good lib, that's java, all is ok.
When it come to platform specific code, the nightmare begin. In the end you'll have to implement platform specific code for the ads, eventually the leaderboard (if you want to use the Google Leaderboard), and it will not work due to some weirds error like linking error, or behavior that change between platform (the admob integration don't work the same for ios/android, but they are a bit similar). And, despite the fact that's java, if you try to use "Calendar" class for example, your project will no longer compil the HTML version.
If you use anonymous class (a must in Java/Android), then you'll experience some weirds garbage collection on IOS that will eat your platform specific callbacks (that happened to me on IOS for the ads part). And you'll end by making something dirty like using statics. I loosed a few hours guessing and trying to make things work, and in the end, we abandonned the idea of leaderboard for the IOS part.

Now, back to the topic, I think the language itself is not that scary. The more scariest is the use of multiplatforms tools to make one app run everywhere, setup all the things, find binding that work (hello robopods), good documentation. etc.

EDIT: Maybe a bit of topic :)
NullBit
Posts: 4
Joined: Thu Oct 13, 2016 11:11 pm

Re: Why is everyone scared of C++?

Post by NullBit »

:/ There seems to be some confusion on this thread that I think should be cleared up - anyone just getting into this stuff could end up getting pretty discouraged simply because they were fed some bad information :/

First HTML is not a programming language that is not up for debate. It is a markup language you don't use this to write any sort of application. Applications interpret documents written in markup languages and then decide what to do. For example in your HTML you may have a block of text surrounded by SCRIPT tags - this tells the browser you are using the included block of text is some sort of script, it is up to the browser to determine what to do with it.

Second scripting languages leverage already existing capabilities to preform tasks, think PHP, PowerShell, BASH, RUBY, BATCH - all simply execute tasks that could be preformed by a human (it might just take a long time or be super complex). No matter what you are using you are always limited by what you are writing in. For example, using BATCH (.bat) scripts you could always use the commands normally available using cmd.exe thus nothing "new" can be done, just inventive ways of using what is already there.

Third programming languages are designed to send instructions to a system; this is generalized and is not usually specific to a particular architecture (read you can compile it for anything supported by your compiler). They can influence how a system behaves directly. This opens up possibilities, read up on generating MD5 Hashe Collisions using a GPU for a perfect example of this. Keep in mind not all programming languages are created equal, but as a general rule, the C languages (C, C++, and C#) are suitable for most tasks and probably used on the widest number of platforms apart from Java (not to be confused with Java Script - there is a big difference! -)

A final note - ASM (assembly) is the instruction sets sent to the processor, and are extremely specific to said hardware whereas a programming language has been generalized for almost any hardware. Any more there are only a very few specific reasons you would need to write anything in these. Primarily would be to begin interfacing with hardware that does not currently (or perhaps it is proprietary) have an interface. Study i386 (Intel 80385), amd64, and ARM architectures for more information (there are more out there).

With all of the above in mind, in most cases scripting is acceptable (and preferred over programming) because someone has already written a program to do what is needed, but the task at hand is either tedious or the input is convoluted.

I don't think anyone here (aside from those who are in general afraid of programming) is scared of C++, they are simply using the best tools at their disposal.
nomisinformation
Posts: 2
Joined: Fri Oct 28, 2016 1:10 pm

Re: Why is everyone scared of C++?

Post by nomisinformation »

NullBit wrote::/ There seems to be some confusion on this thread that I think should be cleared up - anyone just getting into this stuff could end up getting pretty discouraged simply because they were fed some bad information :/
I just don't think this is a subject people should be making a lot of these glaring mistakes on, it's incredibly easy to research.
NullBit wrote: Second scripting languages leverage already existing capabilities to preform tasks, think PHP, PowerShell, BASH, RUBY, BATCH - all simply execute tasks that could be preformed by a human (it might just take a long time or be super complex). No matter what you are using you are always limited by what you are writing in. For example, using BATCH (.bat) scripts you could always use the commands normally available using cmd.exe thus nothing "new" can be done, just inventive ways of using what is already there.
This is false. I'm not 100% sure what you're trying to say here but you're wrong. I understand Wikipedia says this (I just looked), but this is a very ignorant description of scripting languages. I think this would encompass languages more like BATCH and BOURNE SHELL scripting, but not languages like Python, Ruby, or PHP. The next paragraph on Wikipedia has a much better description for what we'd typically call a scripting language:
Wikipedia wrote:The term "scripting language" is also used loosely to refer to dynamic high-level general-purpose languages, such as Perl,[2] Tcl, and Python,[3] with the term "script" often used for small programs (up to a few thousand lines of code) in such languages, or in domain-specific languages such as the text-processing languages sed and AWK.
Typically I see any language that isn't a compiled language (C, C++, C#, Java*, Golang, etc.) being labelled as a scripting language. They're typically very dynamic and frequently pass by reference instead of by value (Looking at you Python).

* Java is compiled for the JVM.
NullBit wrote:Keep in mind not all programming languages are created equal, but as a general rule, the C languages (C, C++, and C#) are suitable for most tasks and probably used on the widest number of platforms apart from Java (not to be confused with Java Script - there is a big difference! -)
WHOA full-stop here. Are you seriously trying to say C# is a C language just because it has the letter C as half its name? Because if you are, you're 100% wrong, C# shares syntax with C and nothing else. Objective C would be a better example here, but you really shouldn't focus so much on C IMO. Focus on what the languages do. If you want to tout support for many platforms, Golang is infinitely easier to port than your average C program (GOOS=windows go build), and C# is pure garbage in that category because it requires a .NET-like framework to even function (don't mention to me mono or any of that, the fact of the matter is you don't see a lot of C# programs outside of the Windows ecosystem, and if you do, they usually come with some "fun" issues to figure out).
NullBit wrote:With all of the above in mind, in most cases scripting is acceptable (and preferred over programming) because someone has already written a program to do what is needed, but the task at hand is either tedious or the input is convoluted.
Scripting is a form of programming. Also that's not the only reason we use scripting languages. If that was, we'd just write better and better libraries instead of worrying about all these silly language options. Scripting languages are generally easier to code in, but suffer from various downsides too because of their dynamic nature (Python's ability to mutate a variable into any type isn't done by magic ;)). You seem to be confused on the Wikipedia definition, or you're very old and also somehow don't know the difference between the bourne shell and Perl.
NullBit wrote:I don't think anyone here (aside from those who are in general afraid of programming) is scared of C++, they are simply using the best tools at their disposal.
I agree. Your explanation may have been lacking, but your conclusion is sound. If someone uses C, it's doubtful they couldn't program in C++. I personally don't use C++ because I also see no reason to. I don't like its syntax at all, and generally (not always) I find proper C++ code at the end of the day, is C code.

I personally use Golang and as long as it exists, I don't think I'll ever have a reason to go back to C++ for anything ever again (you know, excluding existing projects).
Locked

Return to “Programming and Security”