• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Tiktaalik

Member
Because you may need to program microcontrollers for mechanical engineering projects.

Great answer. Hell you might even need to dip into assembly with some of these microcontrollers, I know I did when I was at engineering school in ~2005 and did stuff with the Motorola 68HC11.
 

mantidor

Member
Back in college I found easier to work with assembly than with C, because I loved having absolute control of what was going on, it also made me take a bit longer to finish things, but I wouldn't had had it any other way.

Now I'm in the opposite end of the spectrum doing MVC with c#.
 

TheExodu5

Banned
Back in college I found easier to work with assembly than with C, because I loved having absolute control of what was going on, it also made me take a bit longer to finish things, but I wouldn't had had it any other way.

A bit longer is a bit of an understatement, don't you think?

It's nice to know how assembly works and all, but using it functionally is a nightmare, especially if you're dealing with a 2 register processor.

Now that C, and even Java microcontrollers are cheap, and FPGA/ASIC designs are viable alternatives for more performance oriented tasks, I don't really know why you'd ever want to code in assembly. You might want to use assembly to optimize a few critical paths if the processor's branch prediction sucks or something...but is there any other reason you'd want to use it over C?
 

injurai

Banned
A bit longer is a bit of an understatement, don't you think?

It's nice to know how assembly works and all, but using it functionally is a nightmare, especially if you're dealing with a 2 register processor.

Now that C, and even Java microcontrollers are cheap, and FPGA/ASIC designs are viable alternatives for more performance oriented tasks, I don't really know why you'd ever want to code in assembly.

I've often heard that is more efficient to write in C than assembly because C compilers are most of the time going to optimize your code better than the majority of people could write assembly.
 

TheExodu5

Banned
I've often heard that is more efficient to write in C than assembly because C compilers are most of the time going to optimize your code better than the majority of people could write assembly.

Funny thing I found out throughout University: microcontroller manufacturers have different compiler tiers and charge a shit ton of money for the more optimized compilers ($10K+).
 

TheExodu5

Banned
Why am I not surprised >.<
The worst part is that when you go to compile, it gives you the exact stats for size/performance both for the cheap and expensive compiler. "If you give us $10K, your compiled code would be this much smaller and perform this much faster".
 

injurai

Banned
The worst part is that when you go to compile, it gives you the exact stats for size/performance both for the cheap and expensive compiler. "If you give us $10K, your compiled code would be this much smaller and perform this much faster".

I am surprised about this. I guess it could be helpful for companies looking to upgrade, but it seems all about the money to me.
 

Haly

One day I realized that sadness is just another word for not enough coffee.
Can someone explain why professionals avoid the STL classes?

Inefficiency or unreliability?
 

Sqorgar

Banned
Can someone explain why professionals avoid the STL classes?

Inefficiency or unreliability?
It's slow, ugly, inconsistent, buggy, a nightmare to debug, missing features, and bloated. It's like someone decided to use every C++ feature available in every class, differently.

Note: I haven't programmed with STL in 10 years, so maybe it is better now.
 

usea

Member
It's slow, ugly, inconsistent, buggy, a nightmare to debug, missing features, and bloated. It's like someone decided to use every C++ feature available in every class, differently.

Note: I haven't programmed with STL in 10 years, so maybe it is better now.
It is much better now.

Can someone explain why professionals avoid the STL classes?

Inefficiency or unreliability?
The STL is written to be very general and good for a huge variety of situations. These days, the biggest use for C++ is when you need something to be efficient in a specific way, such as under tight memory limitations or few spare cpu cycles. General solutions are not always in line with those goals. So implementations that are more specific usually work better. Unfortunately, what is a good implementation for one project might be terrible for another, so they're rewritten all the time.
 

MThanded

I Was There! Official L Receiver 2/12/2016
Hey im popping in here.

Currently working on my PhD in computer engineering(embedded systems safety/security).

Whats going on in this thread?

I love C and assembly.
 

Linkhero1

Member
I refresh my Java knowledge from time to time. I recently went through an SCJP book, which was a very good book. 6 is now 7, but I'm not sure if the book has updated yet. This is the book, it assumes you have read through something like HeadFirst Java:

http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060/ref=sr_1_1?s=books&ie=UTF8&qid=1338420701&sr=1-1


My personal favorite in order to learn the language a little more in-depth was the complete reference, which is surprisingly readable and technical at the same time. Additionally, it fills in Java 7 features which the previous book didn't cover:

http://www.amazon.com/Java-The-Complete-Reference-Edition/dp/0071606300/ref=sr_1_1?s=books&ie=UTF8&qid=1338420839&sr=1-1

If you want videos, this series from UC Berkeley is very good, and covers a ton of material. You start at the basics and work with common data structures and algorithms in Java:

http://www.youtube.com/playlist?list=PL4BBB74C7D2A1049C

Thank you. I will look into these. :)
 

mantidor

Member
A bit longer is a bit of an understatement, don't you think?

It's nice to know how assembly works and all, but using it functionally is a nightmare, especially if you're dealing with a 2 register processor.

Now that C, and even Java microcontrollers are cheap, and FPGA/ASIC designs are viable alternatives for more performance oriented tasks, I don't really know why you'd ever want to code in assembly. You might want to use assembly to optimize a few critical paths if the processor's branch prediction sucks or something...but is there any other reason you'd want to use it over C?

Oh I completely agree, I did this more than 10 years ago when it was a different story, there really asn't a good c compiler as far as I remember, I also used assembly for really simple projects. The most complex one was my thesis but the program was actually easy.
 

KageZero

Member
I got stuck on this so if anyone could help me solve it...
Anyway i have a structure that contains names,surnames,grade,etc of students. So i have to calculate the average grade and save it to structure and then i have to sort all students by their average grade. I completed this but i can only sort it by the average while the name,surname remain in same order. Now i somehow manged to sort it with a additional field but is it anyhow possible to sort it without it so i don't "waste" time on this that much. Thanks in advance
 

Truant

Member
Recently tried to learn C#. If I do a tutorial app, I can modify that basic code to add more logic and stuff, but I think it's really tough to add new elements, and have them work together. For me that's the difficult part.
 
Back in college I found easier to work with assembly than with C, because I loved having absolute control of what was going on, it also made me take a bit longer to finish things, but I wouldn't had had it any other way.

Now I'm in the opposite end of the spectrum doing MVC with c#.

took my first assembly course this semester and it was so fun -- had to code a compressor/decompressor using huffman code algorithm for my final project. So cool
 

Lathentar

Looking for Pants
Can someone explain why professionals avoid the STL classes?

Inefficiency or unreliability?

If memory is an concern, its possible to have code bloat issues. Its much easier to control the size of your code if you steer clear of templates. I wouldn't say that all professionals avoid the STL classes though, I certainly don't.
 

amrihua

Member
Recently tried to learn C#. If I do a tutorial app, I can modify that basic code to add more logic and stuff, but I think it's really tough to add new elements, and have them work together. For me that's the difficult part.

Do you have any prior programming experience? Learning OOP when you have no prior experience is a huge hill to climb.
 

Lanbeast

Member
Any newbies like me in here doing CodeYear? I made a huge mistake back in college and didn't go comp sci so now I'm trying to wiggle my way back in during the little bit of free time I have.

I'm not very far in because I just started it this week, but it's really satisfying so far. I'm excited to get to the more difficult stuff. Just wondering if anyone else had any impressions.
 
I got stuck on this so if anyone could help me solve it...
Anyway i have a structure that contains names,surnames,grade,etc of students. So i have to calculate the average grade and save it to structure and then i have to sort all students by their average grade. I completed this but i can only sort it by the average while the name,surname remain in same order. Now i somehow manged to sort it with a additional field but is it anyhow possible to sort it without it so i don't "waste" time on this that much. Thanks in advance
What language? Sounds like u should be using an array of struct/node and pointers for this problem.
 
Unity3D programmer (C#) here. I did some VHDL in my last job.

Any newbies like me in here doing CodeYear? I made a huge mistake back in college and didn't go comp sci so now I'm trying to wiggle my way back in during the little bit of free time I have.

I'm not very far in because I just started it this week, but it's really satisfying so far. I'm excited to get to the more difficult stuff. Just wondering if anyone else had any impressions.

I thought they repeated things a few too many times and some of the lessons have some frustrating bugs or poor instructions, but I've felt like it's been worth the time to get some time in with web based stuff since I haven't been able to find another way to get some practice for JS/CSS/HTML, etc.
 

Kikarian

Member
Any newbies like me in here doing CodeYear? I made a huge mistake back in college and didn't go comp sci so now I'm trying to wiggle my way back in during the little bit of free time I have.

I'm not very far in because I just started it this week, but it's really satisfying so far. I'm excited to get to the more difficult stuff. Just wondering if anyone else had any impressions.
Comp Sci is a great course. But's it's a course you like or hate. I personally loved it.
 
Guys if I want to learn C++ on Mac what program would you recommend? I'm new to mac so getting used to whole OS in the process
 
Why hallo thar fellow programmers, I started out learning Processing then I moved to Javascript. I consider myself to be a newbie.

I'm using ImpactJS to make my first game. All those resources in the OP are exactly what I've been looking for! Thanks!

Oh and I love udacity, Thrun is such a boss.
 

Randdalf

Member
I've just installed the C/C++ tools for Eclipse as I found Visual Studio incredibly confusing and difficult to work with previously. Anyone else use Eclipse for languages other than Java?
 

Bollocks

Member
I've just installed the C/C++ tools for Eclipse as I found Visual Studio incredibly confusing and difficult to work with previously. Anyone else use Eclipse for languages other than Java?

Why? Visual Studio is one of the best IDE's there is, if I could I'd use it all the time.
I use Eclipse for Android and Python btw
 

Hilbert

Deep into his 30th decade
Why? Visual Studio is one of the best IDE's there is, if I could I'd use it all the time.
I use Eclipse for Android and Python btw

Programming in somethign other than Visual Studio sounds like my idea of hell.

Granted I don't have much experience with others, other than a brief stint with (I think)G++ in college.
 

Randdalf

Member
Why? Visual Studio is one of the best IDE's there is, if I could I'd use it all the time.
I use Eclipse for Android and Python btw

I dunno, I'll probably go back to it to compare, I just didn't have the best experience trying to compile even the most simple of programs. Eclipse CDT doesn't have the best auto-correct features and stuff like that for C/C++ so I may end up using Visual Studio anyway...
 

Sqorgar

Banned
Updated OP with Game Design links provided by 4chan's /vg/ Amateur dev general thread.
Since a few of those links already link to my website, I may as well pimp it properly.

Three Hundred Mechanics - An old challenge to myself to come up with unique, illustrated video game ideas every day. The challenge has long since ended, but I still occasionally add new ones. Quite a few of these ideas have been made by third parties, and I've been told that the site is very inspirational.

The Blind Mapmaker - Procedurally generated content is a hobby of mine, and this is a bunch of ideas I had about how to do stuff like create a procedural Zelda map and stuff like that. It's a bit of an esoteric subject matter, but I've had some very positive feedback on this as well.
 

Chris R

Member
Since a few of those links already link to my website, I may as well pimp it properly.

The Blind Mapmaker - Procedurally generated content is a hobby of mine, and this is a bunch of ideas I had about how to do stuff like create a procedural Zelda map and stuff like that. It's a bit of an esoteric subject matter, but I've had some very positive feedback on this as well.

Oh wow, I know what I'm reading during my lunch break today (and over the weekend it looks like... damn that is cool).
 

Randdalf

Member
Since a few of those links already link to my website, I may as well pimp it properly.

Three Hundred Mechanics - An old challenge to myself to come up with unique, illustrated video game ideas every day. The challenge has long since ended, but I still occasionally add new ones. Quite a few of these ideas have been made by third parties, and I've been told that the site is very inspirational.

The Blind Mapmaker - Procedurally generated content is a hobby of mine, and this is a bunch of ideas I had about how to do stuff like create a procedural Zelda map and stuff like that. It's a bit of an esoteric subject matter, but I've had some very positive feedback on this as well.

Oh wow I remember reading those when I was in secondary school, really interesting stuff man.
 

Zoe

Member
Programming in somethign other than Visual Studio sounds like my idea of hell.

Granted I don't have much experience with others, other than a brief stint with (I think)G++ in college.

I'm completely spoiled by IntelliSense. That's the same reason I use Dreamweaver for HTML.
 

Septimius

Junior Member
I dunno, I'll probably go back to it to compare, I just didn't have the best experience trying to compile even the most simple of programs. Eclipse CDT doesn't have the best auto-correct features and stuff like that for C/C++ so I may end up using Visual Studio anyway...

Really? It might be the fact that I'm used to IDEs, but nothing has been easier to start using for me than Visual Studio. Intellisense is absolutely spoiling me stupid.
 

SamVimes

Member
I want to write a function in C or Javascript that takes as an argument two arrays and returns true if the second array is contained in the first (for example array1[1,2,3,4,5] array2[1,3,4,] would return true), false if isn't.
I think i have to run a double for cycle but i'm not really sure how to set the condition, am i missing some built-in function that allows me to check how many elements are contained in an array?

edit: wait, i probably just have to use struct node.
 

Sqorgar

Banned
I want to write a function in C or Javascript that takes as an argument two arrays and returns true if the second array is contained in the first (for example array1[1,2,3,4,5] array2[1,3,4,] would return true), false if isn't.
I think i have to run a double for cycle but i'm not really sure how to set the condition, am i missing some built-in function that allows me to check how many elements are contained in an array?
Been a while since I've done Java, but assuming order doesn't matter and there aren't any duplicates, then this is a straight up Set question. Convert both arrays to sets, grab the union between them, and check to see if it has the same size as either of the original sets.

Sorry, my reading is crap. In C? Two for loops should do it. Javascript, I'm not too familiar with.
 

Slavik81

Member
Guys if I want to learn C++ on Mac what program would you recommend? I'm new to mac so getting used to whole OS in the process
I think your options are Eclipse, Code::Blocks, QtCreator, and maybe XCode.

Personally, I'd use QtCreator. It's impressed me quite a bit. But given that I haven't used any of the others, and I don't have a Mac I'm not sure how valuable my advice is.
 

BreakyBoy

o_O @_@ O_o
Really? It might be the fact that I'm used to IDEs, but nothing has been easier to start using for me than Visual Studio. Intellisense is absolutely spoiling me stupid.

Yeah, it's really just a personal preference thing. I can see liking all those features, but I always just feel that it slows me down more often than not. I like some autocomplete, but not very much, and little else besides that. So, lately my "editor" of choice is Sublime Text, which isn't an IDE at all, it's just a really nice text editor with some code highlighting and some light autocompletion.

Whatever works for you, is what I say.
 
I think your options are Eclipse, Code::Blocks, QtCreator, and maybe XCode.

Personally, I'd use QtCreator. It's impressed me quite a bit. But given that I haven't used any of the others, and I don't have a Mac I'm not sure how valuable my advice is.

Are all of those IDEs ?

What about good text editors?
 

BreakyBoy

o_O @_@ O_o
Are all of those IDEs ?

What about good text editors?

As I mentioned earlier, my current favorite is Sublime Text. It does what I need it to do, it supports the majority of syntaxes I need pretty well, it's got a nice feature set, and it works well across all three major OSes.

Free to try, nothing locked down.
 
Programming in somethign other than Visual Studio sounds like my idea of hell.

Granted I don't have much experience with others, other than a brief stint with (I think)G++ in college.

It is hell IMO and I've been forced to use other IDEs on other projects. Nothing feels as easy or as quick to use as Visual Studio by comparison. Visual Studio really does spoil you on some things.

Experienced programmers are more used to the language and generally use things like VIM, Emacs and gEdit which just have a simpler interface and less bloat to them. It really doesn't matter though.

There's more to VS than just being a glorified text editor though. Our development house has plenty of really experienced programmers and we all here prefer using Visual Studio over the alternatives.
 
Top Bottom