I guess the hours in the office were a bit too long the last couple weeks ^_^. At least, If I remember correctly, the code I dreamed of was pretty clean and would have probably compiled without any issues (if my brain would accept C/C++ code

Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
shin ken
Germany612 Posts
August 15 2015 20:28 GMT
#13141
I guess the hours in the office were a bit too long the last couple weeks ^_^. At least, If I remember correctly, the code I dreamed of was pretty clean and would have probably compiled without any issues (if my brain would accept C/C++ code ![]() | ||
Cyx.
Canada806 Posts
August 15 2015 20:39 GMT
#13142
On August 16 2015 03:20 sabas123 wrote: Im writing a little opengl mini platformer from scracth. But I can't decided if I will do it in plain C or fully oop in c++. My main concern with doing it in C is how to handle the logic, and every solution I come up with is pretty much writing something that handles function pointers for me. That is something that feels very wierd for me to write that when I can just pick c++. Advise is welcome. I've always felt the same when writing C as a C++ programmer. For a game, I would always use C++, because like destructors bro. Honestly for anything userland I would use C++ over C because 1) I hate writing free and 2) I always need to implement some sort of virtual function-like thing at some point, and I'd rather just have that built in. Even if you don't use anything but destructors and virtual functions from C++, I think it's completely worth it. Now, for operating systems, I would say you have a decent case for C - but even then, I've seen OS projects that were 'C++ without the crazy shit' (basically, 'no templates but STL, only public single inheritance', etc) and they avoid a lot of the 'hidden complexity' problems that people (Linus) complain about with respect to C++. | ||
Shield
Bulgaria4824 Posts
August 15 2015 21:13 GMT
#13143
On August 16 2015 05:39 Cyx. wrote: Show nested quote + On August 16 2015 03:20 sabas123 wrote: Im writing a little opengl mini platformer from scracth. But I can't decided if I will do it in plain C or fully oop in c++. My main concern with doing it in C is how to handle the logic, and every solution I come up with is pretty much writing something that handles function pointers for me. That is something that feels very wierd for me to write that when I can just pick c++. Advise is welcome. I've always felt the same when writing C as a C++ programmer. For a game, I would always use C++, because like destructors bro. Honestly for anything userland I would use C++ over C because 1) I hate writing free and 2) I always need to implement some sort of virtual function-like thing at some point, and I'd rather just have that built in. Even if you don't use anything but destructors and virtual functions from C++, I think it's completely worth it. Now, for operating systems, I would say you have a decent case for C - but even then, I've seen OS projects that were 'C++ without the crazy shit' (basically, 'no templates but STL, only public single inheritance', etc) and they avoid a lot of the 'hidden complexity' problems that people (Linus) complain about with respect to C++. Linus is an asshole as far as programming goes and no one should listen to him. I find his favourite C complete nightmare as far as safety is concerned. Modern C++ is absolutely awesome. Once you know about smart pointers and RAII (initialise at constructor, deallocate at destructor), then you're pretty ok. One just needs to read the Effective C++ books to fully appreciate this language and use it correctly most of the time. ![]() The only thing I don't like about C++ is its lack of built-in GUI, but I guess QT and MFC (outdated and only for Windows) are possible options. | ||
Sufficiency
Canada23833 Posts
August 15 2015 21:34 GMT
#13144
On August 14 2015 07:03 darkness wrote: I have almost one year work experience as a software engineer, and because I'm still young, I'm wondering if I should go for a masters degree at some point. By the time I save up enough for masters study in the UK (I already have BSc in the UK), I'll have had about 3 years work experience, so is it worth it then? My family values higher education, and if I go for masters, I'll do it only because of 1) higher salary/better CV and 2) prestige, but the 1st is more important for me. I don't like theoretical thesis though. ![]() Edit: I'm using C#, C++, WCF and WPF if it matters. I also know Java. I am not sure how it works in the UK, but my impression is that a MSc in computer science has little to do with software development. So I am not sure if your three years of experience means anything. | ||
Sufficiency
Canada23833 Posts
August 15 2015 21:37 GMT
#13145
I have been using Python on and off for half a year now. I don't claim to be an expert by any means (in fact I still struggle with list comprehension and need to rely on Google's help), but I just want to say that writing code in Python has been a truly enjoyable process for me. This comes from someone who started out with C++ at an early age. | ||
sabas123
Netherlands3122 Posts
August 15 2015 22:23 GMT
#13146
On August 16 2015 06:37 Sufficiency wrote: A small digression: I have been using Python on and off for half a year now. I don't claim to be an expert by any means (in fact I still struggle with list comprehension and need to rely on Google's help), but I just want to say that writing code in Python has been a truly enjoyable process for me. This comes from someone who started out with C++ at an early age. Can you tell me why python is so awesome? I personally only have touched the c family of c/c++, php and c#. | ||
WolfintheSheep
Canada14127 Posts
August 15 2015 22:32 GMT
#13147
On August 16 2015 07:23 sabas123 wrote: Show nested quote + On August 16 2015 06:37 Sufficiency wrote: A small digression: I have been using Python on and off for half a year now. I don't claim to be an expert by any means (in fact I still struggle with list comprehension and need to rely on Google's help), but I just want to say that writing code in Python has been a truly enjoyable process for me. This comes from someone who started out with C++ at an early age. Can you tell me why python is so awesome? I personally only have touched the c family of c/c++, php and c#. Same reason why C# is so much nicer to work with than C/C++ or PHP, really. It's newer, so there's far less bullshit syntax and legacy support clogging up your code. And decades of standards and accepted functionality are actually integrated into the languages, rather than requiring non-standard packages. And Python in general is one of the cleanest looking coding standards around, with much less bracket usage or random symbols. Of course, whether the languages are better or more useful is another matter entirely. | ||
Sufficiency
Canada23833 Posts
August 15 2015 22:37 GMT
#13148
On August 16 2015 07:23 sabas123 wrote: Show nested quote + On August 16 2015 06:37 Sufficiency wrote: A small digression: I have been using Python on and off for half a year now. I don't claim to be an expert by any means (in fact I still struggle with list comprehension and need to rely on Google's help), but I just want to say that writing code in Python has been a truly enjoyable process for me. This comes from someone who started out with C++ at an early age. Can you tell me why python is so awesome? I personally only have touched the c family of c/c++, php and c#. Because it's simple and it WORKS. No bullshit. Why bother spending hours writing the code in C/C++/Java when you can get it right in a couple of lines in Python? | ||
Shield
Bulgaria4824 Posts
August 15 2015 23:08 GMT
#13149
On August 16 2015 07:37 Sufficiency wrote: Show nested quote + On August 16 2015 07:23 sabas123 wrote: On August 16 2015 06:37 Sufficiency wrote: A small digression: I have been using Python on and off for half a year now. I don't claim to be an expert by any means (in fact I still struggle with list comprehension and need to rely on Google's help), but I just want to say that writing code in Python has been a truly enjoyable process for me. This comes from someone who started out with C++ at an early age. Can you tell me why python is so awesome? I personally only have touched the c family of c/c++, php and c#. Because it's simple and it WORKS. No bullshit. Why bother spending hours writing the code in C/C++/Java when you can get it right in a couple of lines in Python? Because of performance/efficiency and predictability. Languages like Java, C# and any with a garbage collector are non-deterministic. You don't know when the garbage collector is going to kick in. It's not about C/C++/Java vs Python though. Sometimes, you don't care and want a quick GUI which you may do in Java or whatever language you have, while that same application uses native code (C/C++) if performance is a key for some application logic. In other words, you use several languages at once. | ||
Manit0u
Poland17187 Posts
August 16 2015 00:30 GMT
#13150
On August 16 2015 03:20 sabas123 wrote: Im writing a little opengl mini platformer from scracth. But I can't decided if I will do it in plain C or fully oop in c++. My main concern with doing it in C is how to handle the logic, and every solution I come up with is pretty much writing something that handles function pointers for me. That is something that feels very wierd for me to write that when I can just pick c++. Advise is welcome. Why not just use C but back it up with Lua? What you get with that: 1. Separation of concerns: You can write your game engine in C and do everything game-related in your scripts. You can then develop them separately without breaking the other thing. 2. Stability: Your script crashing doesn't crash the entire app since it runs inside a virtual machine. 3. Extensibility: You can run several virtual machines concurrently within the same app (useful for mulitplayer stuff for example). 4. Performance: While you take a performance hit from running your scripts inside a virtual machine, you get great performance from having your core engine in C. With Lua you can also control its stack all the time and it's you who decides when vm's start, stop and how many of them are running (you don't use more resources than you need). 5. Abstraction: Scripting languages like Lua provide you with a nice layer of abstraction and tools that are otherwise hard to achieve in C or C++ (take coroutines for example, which is also a way to introduce multi-threading, as a bonus you also get stuff like sparse tables, linked lists, metamethods and all that jazz). | ||
Cyx.
Canada806 Posts
August 16 2015 00:41 GMT
#13151
On August 16 2015 06:13 darkness wrote: Linus is an asshole as far as programming goes and no one should listen to him. I find his favourite C complete nightmare as far as safety is concerned. Modern C++ is absolutely awesome. Once you know about smart pointers and RAII (initialise at constructor, deallocate at destructor), then you're pretty ok. One just needs to read the Effective C++ books to fully appreciate this language and use it correctly most of the time. ![]() I somewhat agree with him when it comes to operating systems (and complex embedded systems as well) - C has a clarity about its performance and memory tradeoffs that I think C++ misses sometimes, and I do think that's valuable in those places. I do like (as I said before) the idea of using a limited subset of C++ for that kind of thing, though. Edit: For clarity, I think Linus is totally wrong about his reasons for using C in things like Git - but for the Linux kernel, I understand where he's coming from. | ||
Sufficiency
Canada23833 Posts
August 16 2015 01:17 GMT
#13152
On August 16 2015 08:08 darkness wrote: Show nested quote + On August 16 2015 07:37 Sufficiency wrote: On August 16 2015 07:23 sabas123 wrote: On August 16 2015 06:37 Sufficiency wrote: A small digression: I have been using Python on and off for half a year now. I don't claim to be an expert by any means (in fact I still struggle with list comprehension and need to rely on Google's help), but I just want to say that writing code in Python has been a truly enjoyable process for me. This comes from someone who started out with C++ at an early age. Can you tell me why python is so awesome? I personally only have touched the c family of c/c++, php and c#. Because it's simple and it WORKS. No bullshit. Why bother spending hours writing the code in C/C++/Java when you can get it right in a couple of lines in Python? Because of performance/efficiency and predictability. Languages like Java, C# and any with a garbage collector are non-deterministic. You don't know when the garbage collector is going to kick in. It's not about C/C++/Java vs Python though. Sometimes, you don't care and want a quick GUI which you may do in Java or whatever language you have, while that same application uses native code (C/C++) if performance is a key for some application logic. In other words, you use several languages at once. I don't disagree with you, but: 1. In terms of performance, there is no denial that C/C++ is awesome. But when you factor in the CPU cost of using a more inefficient platform and the human cost of writing code on more complicated (but efficient) platform, it's easy to see that performance is not a big factor unless you are creating a very niche application. As computer hardware becomes more powerful, this is going to be the case even more in the future 2. C/C++ does generate more opportunities for more customized garbage collection which may increase performance, but it also carries the risk of getting it wrong, which can be very difficult (if not impossible) to fix. | ||
Cyx.
Canada806 Posts
August 16 2015 04:57 GMT
#13153
On August 16 2015 10:17 Sufficiency wrote: I don't disagree with you, but: 1. In terms of performance, there is no denial that C/C++ is awesome. But when you factor in the CPU cost of using a more inefficient platform and the human cost of writing code on more complicated (but efficient) platform, it's easy to see that performance is not a big factor unless you are creating a very niche application. As computer hardware becomes more powerful, this is going to be the case even more in the future 2. C/C++ does generate more opportunities for more customized garbage collection which may increase performance, but it also carries the risk of getting it wrong, which can be very difficult (if not impossible) to fix. Sure, that's why I was referring to specifically operating systems and certain classes of embedded system. ![]() | ||
Manit0u
Poland17187 Posts
August 16 2015 09:32 GMT
#13154
On August 16 2015 09:41 Cyx. wrote: Show nested quote + On August 16 2015 06:13 darkness wrote: Linus is an asshole as far as programming goes and no one should listen to him. I find his favourite C complete nightmare as far as safety is concerned. Modern C++ is absolutely awesome. Once you know about smart pointers and RAII (initialise at constructor, deallocate at destructor), then you're pretty ok. One just needs to read the Effective C++ books to fully appreciate this language and use it correctly most of the time. ![]() I somewhat agree with him when it comes to operating systems (and complex embedded systems as well) - C has a clarity about its performance and memory tradeoffs that I think C++ misses sometimes, and I do think that's valuable in those places. I do like (as I said before) the idea of using a limited subset of C++ for that kind of thing, though. Edit: For clarity, I think Linus is totally wrong about his reasons for using C in things like Git - but for the Linux kernel, I understand where he's coming from. I've read the entirety of C vs C++ for Git discussion and in my eyes Linus makes a lot of good points there: 1. The most important thing in Git is performance. You can't really trump C in that matter. 2. C is much less forgiving than C++, which leads to tighter code reviews and requiring more competence on the developer's side. It's also much simpler, making it easier to debug. 3. The biggest gripe Linus has with C++ is the fact that the language offers too much freedom to the programmer (think opposite of Python, where there's only one best way to do something). This in turn makes for huge code discrepancies between programmers (even within C++ libraries you have some math stuff that's inconsistent and incompatible with each other, like matrices), which can be a nightmare to review and debug in an open source project with many contributors. | ||
spinesheath
Germany8679 Posts
August 16 2015 11:35 GMT
#13155
On August 16 2015 18:32 Manit0u wrote: I've read the entirety of C vs C++ for Git discussion and in my eyes Linus makes a lot of good points there: 1. The most important thing in Git is performance. You can't really trump C in that matter. The most important thing in Git certainly is not performance. Stability and correctness/integrity are far more important. I don't give a damn about a revision control system I can't rely on, no matter how fast it is. | ||
Manit0u
Poland17187 Posts
August 16 2015 11:49 GMT
#13156
On August 16 2015 20:35 spinesheath wrote: Show nested quote + On August 16 2015 18:32 Manit0u wrote: I've read the entirety of C vs C++ for Git discussion and in my eyes Linus makes a lot of good points there: 1. The most important thing in Git is performance. You can't really trump C in that matter. The most important thing in Git certainly is not performance. Stability and correctness/integrity are far more important. I don't give a damn about a revision control system I can't rely on, no matter how fast it is. Well, those things are so obvious in version control system that I've decided to omit them in my elaboration and focused on the next most important thing. After all, what good would be a vcs that takes forever to do anything? "Torvalds wanted a distributed system that he could use like BitKeeper, but none of the available free systems met his needs, particularly in terms of performance." - after Wikipedia "Git was designed as a set of programs written in C, and a number of shell scripts that provide wrappers around those programs. Although most of those scripts have since been rewritten in C for speed and portability" - ibidem | ||
spinesheath
Germany8679 Posts
August 16 2015 12:23 GMT
#13157
| ||
Nesserev
Belgium2760 Posts
August 16 2015 13:15 GMT
#13158
| ||
Manit0u
Poland17187 Posts
August 16 2015 13:30 GMT
#13159
| ||
TMG26
Portugal2017 Posts
August 16 2015 14:42 GMT
#13160
On August 16 2015 22:30 Manit0u wrote: I never brought up C vs C++... Just mentioned reasons Linus pointed out to go with one over the other. And people ignored your other 2 points. That are more important in big open source projects. | ||
| ||
![]() StarCraft 2 StarCraft: Brood War Dota 2 Counter-Strike Super Smash Bros Heroes of the Storm Other Games Organizations
StarCraft 2 • Berry_CruncH266 StarCraft: Brood War• IntoTheiNu ![]() ![]() • LaughNgamezSOOP • sooper7s • Migwel ![]() • Laughngamez YouTube • AfreecaTV YouTube • IndyKCrew ![]() • Kozan • intothetv ![]() |
PiG Sty Festival
MaxPax vs Classic
Dark vs Maru
SC Evo Complete
[BSL 2025] Weekly
Online Event
Replay Cast
SOOP Global
ByuN vs Zoun
Rogue vs Bunny
PiG Sty Festival
herO vs Rogue
ByuN vs SKillous
Sparkling Tuna Cup
BSL Nation Wars 2
Online Event
[ Show More ] AI Arena 2025 Tournament
Replay Cast
The PondCast
|
|