September 26, 2020, 12:37:05 PM

Author Topic: Fears of C++?  (Read 1005 times)

Online Amon.

  • Full Member
  • ***
  • Posts: 194
  • What? There's no ceiling outside?
    • Amon.Pro
Fears of C++?
« on: January 20, 2020, 09:45:27 PM »
In my younger days, which is a long time ago, I never went near C++ as I thought it was too difficult to learn. It was difficult to learn back then for me due to my complete inexperience with coding, coding logic, game logic etc.
Now, I've noticed that all these decades later that I still fear C++. Why though? Is it because that mindset of finding C++ difficult to learn has never been challenged in my mind? Am I wrong to be like this now?
How many of you still limit yourselves, like I do, with past coding fears that you have never challenged?
Do you fear C++?
Windows 10 Pro - 16GB DDR4 RAM - GEFORCE RTX 2080 TI 11GB - AMD RYZEN 7 3800X

Offline Matty

  • Hero Member
  • *****
  • Posts: 1170
    • MattiesGames
Re: Fears of C++?
« Reply #1 on: January 20, 2020, 10:30:21 PM »
It probably isnt c plus plus that does it to you.  It's probably, if youre at all like me, being used to languages that rely less on curly braces and punctuation symbols and so when you see them your eyes gloss over and your brain refuses to engage with it.

But I can say, if you actually spend the time getting past that initial reluctance with any similar language you will find you have no problem and that the barrier falls for other such languages as well.

It's that initial first decision to engage.

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2775
  • elgol 2021
Re: Fears of C++?
« Reply #2 on: January 20, 2020, 11:04:49 PM »
I don't fear C++, but I do think it is getting ever bigger, more complicated and constantly changing without an end in sight, the latest version is version 17!   :o  Imagine if AGK followed that path!

But I wouldn't mind having a go at assembly language, now that is something I've never tackled.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi Zero and pi 4

Online Amon.

  • Full Member
  • ***
  • Posts: 194
  • What? There's no ceiling outside?
    • Amon.Pro
Re: Fears of C++?
« Reply #3 on: January 20, 2020, 11:24:38 PM »
Thanks to Gamemaker Studio 2's GML language, curly braces and apostrophes at the end of direct statements are now a natural coding habit for me. In fact, it was actually Unity and C# that got me used to curly brackets/Braces and apostrophes.
@Matty
That's a very interesting and true point regarding the initial reluctance to challenge the coding language you want to use. I think it's a form of procrastination and ruminating with the procrastination being triggered by the ruminating thoughts.

@Steve Elliot
Assembly Language scared me more than C++. I guess all the hype about it and reading how others stated its difficulty in using made me steer clear of it much in the same way I did with C++.
This whole scenario reminds me of subjects like mathematics. I remember me nephew one day, a long time ago, saying to me that maths was hard. I asked him how much maths he had done. He said none. So, I asked him, "if you haven't done any maths, how do you know it's hard to do?". What he said shocked me. He said his friend told him maths was hard. This, my nephew then carried in his mind, never going near a maths book or trying maths because his friend said maths was too hard to do.

Windows 10 Pro - 16GB DDR4 RAM - GEFORCE RTX 2080 TI 11GB - AMD RYZEN 7 3800X

Offline Xerra

  • Hero Member
  • *****
  • Posts: 1091
    • Retro Evolved
Re: Fears of C++?
« Reply #4 on: January 20, 2020, 11:27:11 PM »
But I wouldn't mind having a go at assembly language, now is something I've never tackled.

I dabbled very shallow into this as a teenager but stuff like multiplication of numbers and interrupts put me off, not to mention only having an assembler written in basic that was buggy and slow as hell. I've now picked it up again and decided to push myself and learn it again. It's amazing how much you actually remember considering I've not done any coding with it for over 30 years.

I'm using CBM Prg Studio which, unfortunately, is Windows only as it's a VS like IDE. As Parallels is pretty crap on my mac a lot of the time - for no reason whatsoever it often seems - and drives me to the point of frustration, I've bought myself one of those PC Sticks that you can just plug into a HDMI port of your telly, monitor and you have a computer. Not much use for games or anything heavy on the install size, as it uses an SD card for storage, but having the dev system and Vice for emulation works brilliant on the thing. Considering my Parallels installation was Win 7 and Microsoft decided to block my windows key after a couple of years of use, saying it's no longer valid, this thing has a preinstalled Win 10 Pro - 64 bit which to buy is almost the cost of the device itself. A right bargain, but getting back on subject....

Prog Studio is a complete dev system for any Commodore machine and does all the stuff like let you create bitmap chars, sprites, screen maps and stuff, as well as obviously punch in assembly or basic listings. It does all the smart stuff like generate basic loaders and smart relocation of code, so there's no excuse for me to wuss out again. There's a good youtuber called OldSkoolCoder who's been doing tutorials for a few years now and I've been learning a lot of stuff by following what he's doing.

Nothing like the feeling of writing hello world and some other text in 100% assembler and running it for the first time. I couldn't get the hang of doing that with the old tools back in the day. I just used simple peek and poke commands and bounced stuff around in the stack because it was easy.

Probably should have put this into a dedicated post in case it interests someone else really, DOH!.


CBM Prg Studio

http://www.ajordison.co.uk/download.html

OldSkoolCoder youtube channel

https://www.youtube.com/channel/UCtWfJHX6gZSOizZDbwmOrdg/videos


Offline Xerra

  • Hero Member
  • *****
  • Posts: 1091
    • Retro Evolved
Re: Fears of C++?
« Reply #5 on: January 20, 2020, 11:42:20 PM »
But I wouldn't mind having a go at assembly language, now is something I've never tackled.

Can't resist posting this now someones poked the mud with a stick and got my attention :-)


; Hello World example for 6502 Assembly code
; Coding by Tony Brice - 17/01/2020

; Generate basic code for the system call so program can be run like
; a Basic listing. In this case: 10 SYS (2080)

* = $0801

    BYTE    $0E, $08, $0A, $00, $9E, $20, $28,  $32, $30, $38, $30
    BYTE    $29, $00, $00, $00

; Pointer to basic routine from the Kernal Rom that prints a line of text
TEXT_LINE = $AB1E

* = $0820
    ; Load the low byte with the first char of HELLOWORLD
    lda #<HELLOWORLD
    ; Load the high byte with the last char of HELLOWORLD
    ldy #>HELLOWORLD
    ; Jump to subroutine that will print the line of text
    jsr TEXT_LINE
    rts

; Text data is stored in the Macro HELLOWORLD for reference
HELLOWORLD
    text "hello world"
    byte 13
    text "this is 100% machine code"
    byte 13


That's over kill in commenting and probably actual code really but, as it was the first thing I really wrote, I wanted to make sure i understood all of it by making my own notes.

The actual printing of the text (which is the whole point of the code) ironically isn't done in that code. The routine uses one of the functions already in the kernal rom to print a line, which is the same routine the inbuilt basic would use. The difference is it's looking for the text start character from the accumulator and the X register to indicate how many chars there are. That's why there are to byte 13 instructions to do a hard-coded carriage return.

Assembler code does look more complex than it really is. Once you understand the hardware limitations (a 255 byte stack and only 3 registers/variables to work with) it's not too restrictive to do whatever you want. The quality of a lot of the games back then prove that. Working with very little ram is actually quite a good exersize too. You automatically optimise and are constantly thinking how to make something work more efficiently. I doubt I'll ever get to a stage where I write a full game with it but simple prototyping stuff with the machine limitations could be a lot of fun.

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2775
  • elgol 2021
Re: Fears of C++?
« Reply #6 on: January 21, 2020, 08:21:21 AM »
Thanks for all that info Xerra!   :D

Quote
Probably should have put this into a dedicated post in case it interests someone else really, DOH!.

Yes, maybe copy-paste it all into a dedicated C64 Assembly Language thread.  :)
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi Zero and pi 4

Offline dawlane

  • Full Member
  • ***
  • Posts: 166
Re: Fears of C++?
« Reply #7 on: January 21, 2020, 09:20:48 AM »
Assembly Language scared me more than C++. I guess all the hype about it and reading how others stated its difficulty in using made me steer clear of it much in the same way I did with C++.
Once you understand that assembly programming is dealing with low level a one-to-one machine code instructions of a particular CPU, and how to manipulate the data and memory; it's usually straight forward. The real hard part of assembly programming is debugging.

In the good old days of 8 bit and 16 bit home computers. A programmer had to practically have a very close relationship with every component on the computer's PCB to get the best out of it. In other words, you had to have intimate knowledge of not just the CPU, but also the other IC's and system timings. With modern PC's, it's having knowledge of the CPU and how to communicate with the operating system. In a modern PC, it's the operating system that runs the show between you and the rest of the hardware. But in the old home computer days; it was just one or two chips and the CPU wasn't always one of them.

The advantage that C/C++ and many other high level languages is the readability, debugging and cross platform portability of the code with a few minor changes. Plus modern C/C++ etc would be much better at optimising the output, unless you are a very talented assembly coder. You could of course learn to program in one of the cross platform intermediate representation languages such as llvm and target a number of CPU architectures, but you would still have to communicate with the operating system.

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 701
Re: Fears of C++?
« Reply #8 on: January 21, 2020, 09:58:46 AM »
..for some reason, i found curly braces quite comforting, including C++, which turns out to be best choice out there for what i need to do..for desktop side of things i use PB and B4J..

Offline Xerra

  • Hero Member
  • *****
  • Posts: 1091
    • Retro Evolved
Re: Fears of C++?
« Reply #9 on: January 21, 2020, 10:48:18 AM »
..for some reason, i found curly braces quite comforting, including C++, which turns out to be best choice out there for what i need to do..for desktop side of things i use PB and B4J..

Funny that, but I felt exactly the same once I started using them for GML. Whenever I saw C code prior to picking that up i used to just boggle at why the source needed all those characters and just felt it didn't look right. Nowadays looking at code with brackets just makes it easier to read. Proof, I suppose, that you can get used to almost anything once you get your head down and work with it.

Offline Xaron

  • Sr. Member
  • ****
  • Posts: 302
Re: Fears of C++?
« Reply #10 on: January 24, 2020, 11:49:11 AM »
I'm doing now about 20 years of C++ by profession and yet still learn new things. The latest changes were quite cool with unique_ptr stuff and that but personally I prefer C# nowadays. In C++ you can do so many things in a wrong way (max freedom) it's insane.  :))

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: Fears of C++?
« Reply #11 on: January 24, 2020, 03:23:07 PM »
I've looked at C++  a couple of times and really couldn't get on with it . Also tried Java as well and Python . Pythons ok but was a bit slow for my needs or at least what I was doing with it . Currently using PB Which I do get along with. Just started programming again after a six week break and returning to a half finished project and I had to study it for a few hours to get my head around it . I personally wish I had learnt C++ 20 years ago as I would probably be quite good at it by now as it stands I really can't see myself learning it now . PB is pretty powerful and plenty fast enough for my requirements . Tried learning z80 assembly when I was 17 for a few months and really it was over my head . When the guy was talking about carrying the flag and loading the accumulator I was really just not understanding . Still don't really but glad I looked at it and did some reading . I learnt enough to know it was not my thing . Have a nice day .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Jayenkai

  • Jr. Member
  • **
  • Posts: 6
Re: Fears of C++?
« Reply #12 on: January 24, 2020, 06:39:11 PM »
C++ wasn't that hard.
The gradual set of skills learned from blitz/max/monkey along with php stuff, were more than enough to prepare me for the language I probably should've learned decades before any of them!
I opted to use OpenGL, which is also easy enough, and managed to get things running on win, Mac and Linux, as well as on 3DS homebrew.  I "almost" got it going on iOS but needed to figure out Metal, and..  gave up trying.   People suggest Android is doable with c++, too, but ..  gah!

Then MacOS's new rules appeared, making that harder to release stuff on, and .. you just know Microsoft's going to do that eventually too.  We're all stuffed when that happens!

It IS all doable, and it's not as hard as you've built it up to be in your head.  But doing what I do, doing it alone probably wasn't the best option. I prefer to focus on the game bit, not the underlying bit.  I really could've done with my own little Mark Sibly, sitting there fixing the insane number of growing issues.
That was the best bit of Blitz, for me, and without that it all fell apart.

Don't be scared of C++.  But do be scared of the direction that the OSes are taking, and definitely do keep up with all the fixes you need, for every little thing, all the smegging time.

And ... probably don't go alone!

Offline 3DzForMe

  • Hero Member
  • *****
  • Posts: 1109
Re: Fears of C++?
« Reply #13 on: January 25, 2020, 03:24:48 AM »
Aaah, C++, first started learning that back in 2001/2 when I was applying for a coding job with one of my old employers. Funny old thing is, they only ever used 'C' - got accustomed to using that briefly (over 2-3 year period) - then the aircraft I was coding for got scrapped. Wondering if I should blow the dust of my old 'C' books and delve back in - however these days the stuff than can be achieved with AGK as a hobby codist just makes C so unappealing.

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2775
  • elgol 2021
Re: Fears of C++?
« Reply #14 on: January 25, 2020, 08:42:53 AM »
Quote
however these days the stuff than can be achieved with AGK as a hobby codist just makes C so unappealing.

That's where languages like AGK and the Blitz line have a huge advantage over C/C++, because they have built-in features for graphics, sound and support for mouse/game controllers; plus they are designed around game development rather than a general purpose language.  Even if you learn C/C++ you then have to decide on a game engine to go with it, and I think the main ones can be over-kill for hobbyist games.   
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi Zero and pi 4

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal