# I found out what I like \[related to computer coding\]

**URL:** <https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642>\
**Category:** In My Humble Opinion\
**Created:** [September 2, 2018, 2:43pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642 "2018-09-02T14:43:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![pullin](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pullin](https://boards.straightdope.com/u/pullin)\
**Post date:** [September 3, 2018, 10:33am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/21 "2018-09-03T10:33:41Z")

</div>

> [@What\_Exit](#):
>
> However, once you know any computer language, learning the next is easier than learning the first one was.

You will eventually discover a subset of the world’s population who cannot grasp this fact. And they all work in HR.

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [September 3, 2018, 11:05am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/22 "2018-09-03T11:05:14Z")

</div>

> [@beowulff](#):
>
> C is a subset of C++.

Almost but not quite, and in ways which matter to beginning programmers who will take example code at face value. For example, the typing rules in C++ are stricter than in C, so some good example code will work in C but not in C++, and lead to confusing errors if you try to treat it like C++. For an experienced programmer, like you or me, this is an annoyance. For a beginning programmer, like the OP, this _matters_.

**wolly** : Learning Python is good to learn how to program; that is, how to create algorithms and data structures, how to debug, how to structure code so it’s readable, and how to go from an idea to something which runs.

Learning C is good for learning how pointers work, how memory management works at a fairly low level, and how to do things like interface with an OS or, if you go the embedded route, how to directly control hardware.

Going from Python to C will involve a few new concepts, but the basic ideas of algorithms, data structures, code organization, and debugging don’t change.

---

<div class="post-metadata">

**Author:** ![wolly](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@wolly](https://boards.straightdope.com/u/wolly)\
**Post date:** [September 3, 2018, 11:24am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/23 "2018-09-03T11:24:34Z")

</div>

I wanted to learn c++ and not c…

---

<div class="post-metadata">

**Author:** ![wolly](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@wolly](https://boards.straightdope.com/u/wolly)\
**Post date:** [September 3, 2018, 11:57am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/24 "2018-09-03T11:57:44Z")

</div>

I just don’t understand.You can’t use c++ for microcontrollers?Why?Why is c used and not c++?

---

<div class="post-metadata">

**Author:** ![GreenWyvern](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/greenwyvern/32/2834_2.png) [@GreenWyvern](https://boards.straightdope.com/u/GreenWyvern)\
**Post date:** [September 3, 2018, 12:03pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/25 "2018-09-03T12:03:34Z")

</div>

C is good for low-level stuff. You have to understand the bits and bytes and pointers to use it. That also makes it very powerful and fast for programming low-level stuff. It’s NOT object oriented, and it won’t be easy to move from C to C++.

C++ is object oriented and can be used for higher-level programming, but it’s out of date. C# would be better.

You don’t need to learn C to understand pointers, but it could help. If you like hardware and want to understand machine code, start with a simple hardware simulator with a limited instruction set.

I’m still not clear what you actually want to do and why.

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [September 3, 2018, 12:44pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/26 "2018-09-03T12:44:08Z")

</div>

> [@wolly](#):
>
> I just don’t understand.You can’t use c++ for microcontrollers?Why?Why is c used and not c++?

You don’t _need_ most of what C++ gives you in order to write code for microcontrollers. You don’t need objects, because your program won’t be big enough for things like inheritance to make a big difference in complexity, for example. The stricter type rules for C++ would just get in the way, given the kind of code you need to write to control a microcontroller’s peripheral hardware. And so on.

C is better for smaller programs which do relatively simple things very fast. C++ has good features for organizing larger programs, and a few nice features smaller programs can make use of, but it isn’t better than C in all respects, and, in some ways, it’s worse.

---

<div class="post-metadata">

**Author:** ![wolly](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@wolly](https://boards.straightdope.com/u/wolly)\
**Post date:** [September 3, 2018, 2:39pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/27 "2018-09-03T14:39:27Z")

</div>

Even in microprocessors and processors you can use C++ and not C?

---

<div class="post-metadata">

**Author:** ![SamuelA](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@SamuelA](https://boards.straightdope.com/u/SamuelA)\
**Post date:** [September 3, 2018, 2:42pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/28 "2018-09-03T14:42:33Z")

</div>

> [@Derleth](#):
>
> You don’t _need_ most of what C++ gives you in order to write code for microcontrollers. You don’t need objects, because your program won’t be big enough for things like inheritance to make a big difference in complexity, for example. The stricter type rules for C++ would just get in the way, given the kind of code you need to write to control a microcontroller’s peripheral hardware. And so on.
> 
> C is better for smaller programs which do relatively simple things very fast. C++ has good features for organizing larger programs, and a few nice features smaller programs can make use of, but it isn’t better than C in all respects, and, in some ways, it’s worse.

And don’t forget the bigger point. All those extra features like inheritance and templates and tons of other arcane syntax that is very confusing and complicated are basically all done better in Python. Or C#. But especially Python.

And if a program is big enough that writing it in C++ will help, it’s probably running on a system with enough memory for the Python interpreter.

Python’s only drawbacks are it’s slow execution speed and it’s relative newness in large scale systems. And you can fix the execution speed by profiling and redefining/rewriting just that hot 1-5% of the code in C.

---

<div class="post-metadata">

**Author:** ![ftg](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ftg/32/2801_2.png) [@ftg](https://boards.straightdope.com/u/ftg)\
**Post date:** [September 3, 2018, 4:11pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/29 "2018-09-03T16:11:22Z")

</div>

> [@wolly](#):
>
> If you learn C++ can you understand pointers?I mean in Python3 I’ve never seen a pointer.Is it hard understanding what a pointer does if you never worked with them?

C++ has [pointers](http://www.cplusplus.com/doc/tutorial/pointers/) with the usual C operators. I’ve programmed with pointers in C++ many times. But a lot of the commoner uses go away in C++. And that’s a good thing.

It’s Java that has seriously messed up pointers so that coding “fun” linked data structures is a nightmare. (You often have to keep around a reference to a reference.) A large part of the problem is not allowing 1st order call by reference so you make stuff second order for no good reason.

---

<div class="post-metadata">

**Author:** ![wolly](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@wolly](https://boards.straightdope.com/u/wolly)\
**Post date:** [September 3, 2018, 6:01pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/30 "2018-09-03T18:01:03Z")

</div>

So it is okay to start with c++?

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [September 3, 2018, 6:27pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/31 "2018-09-03T18:27:20Z")

</div>

> [@wolly](#):
>
> Even in microprocessors and processors you can use C++ and not C?

Microprocessors cover a lot of ground. 8080s, no. The latest from Intel or ARM, yes.  
You still haven’t told us what this is going to be used for. If you really, really want to learn C++ go ahead, but it might not be as useful as something else.

---

<div class="post-metadata">

**Author:** ![GreenWyvern](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/greenwyvern/32/2834_2.png) [@GreenWyvern](https://boards.straightdope.com/u/GreenWyvern)\
**Post date:** [September 3, 2018, 6:28pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/32 "2018-09-03T18:28:24Z")

</div>

> [@wolly](#):
>
> So it is okay to start with c++?

Everybody here is basically saying no. But I’m sure you’ll do what you want, anyway.

🙂

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [September 3, 2018, 9:59pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/33 "2018-09-03T21:59:45Z")

</div>

> [@wolly](#):
>
> Even in microprocessors and processors you can use C++ and not C?

I do the vast majority of my coding on “small” devices. These days that usually means processors with somewhere between 1K and 64K of SRAM, and 4K and 128K of Flash. In these devices, every single byte counts, so a language that generates compact code is important. Also, I never, ever let software manage my memory. So, no malloc, no recursion, no garbage collection, no fancy “objects” which can instantiate themselves and use unpredictable amounts of stack or heap space. So, C++ is pretty much useless for me on these devices.

---

<div class="post-metadata">

**Author:** ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)\
**Post date:** [September 3, 2018, 11:00pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/34 "2018-09-03T23:00:47Z")

</div>

If you want to learn C++, don’t learn C first. The way that pointers are used in modern C++ is so different from how C uses them learning C first will hurt you far more than it will help. There’s no reason why you can’t learn about pointers while learning C++.

---

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [September 4, 2018, 12:02am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/35 "2018-09-04T00:02:49Z")

</div>

The following may be a useless digression for someone seeking employment, or trying to find the best language for a particular niche or curriculum, BUT …

I’ve wondered whether _personal temperament_ should play a role in a person’s choice of programming language. After all, programming can be fun and fun is good.

As some very old examples, some engineers loved Forth, while others hated it. Lisp also had both ardent lovers and haters.

Although C and C++ may seem similar, I wonder if they sometimes appeal to opposite personality types! The old-fashioned “philosophy” of C is very different from the “philosophy” of C++. Just as one hint of what I’m speaking of: “Use the Source, Luke!” was a common mantra in C programming, while making the source of libraries _unreadable_ was seemingly sometimes touted under C++. :smack:

---

<div class="post-metadata">

**Author:** ![wolly](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@wolly](https://boards.straightdope.com/u/wolly)\
**Post date:** [April 9, 2019, 10:53pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/36 "2019-04-09T22:53:50Z")

</div>

> [@Voyager](#):
>
> BTW, what kind of hardware is it? Gate level, board level, system level, architectural level? I got my PhD in computer architecture, but I spent most of my career on EDA for hardware design with close ties to manufacturing.

Uh,Computer hardware and electrical equipment.That would include RAM,CPU,GPU,SOUND BOARD,security alarm,etc.  
I haven’t found in what field of hardware C++ is used and I guess that C is more common in all electrical or electronical systems.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [April 9, 2019, 11:44pm UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/37 "2019-04-09T23:44:33Z")

</div>

> [@beowulff](#):
>
> So, C++ is pretty much useless for me on these devices.

What a strange statement. I code all the time on small devices and use C++ exclusively. Sure, there are some things that should be avoided, like virtual methods. Other things, like basic organization into classes, is just good coding practice and has no machine overhead. And some things, like templates, are crucial for squeezing every cycle out of a function while maintaining generality.

IMHO, only a masochist would choose C over C++ at this point. C++ compilers are pretty ubiquitous now, even on tiny microcontrollers.

C++'s chief advantages are also its chief weaknesses: its extreme flexibility and extreme power. There are no alternatives, at all, for some kinds of problems. But that does mean it’s overkill for some things.

Python is a fine language but its high level of abstraction means that users can never really understand what’s going on under the covers.

> [@SamuelA](#):
>
> I would not recommend learning C++. It’s essentially an obsolete language. Critical embedded systems like the Linux kernel and most micro-controller and device driver code actually mostly use C.

I’ve been writing device drivers for nearly two decades and we use 100% C++.

And yes, the language does not obligate you to use all features. For various reasons, we don’t use exception handling, nor to we use the STL. Both things like templates are crucial. It’s far beyond just using the C subset of C++. We’re doing a lot of things that are just flat-out impossible under C.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [April 10, 2019, 12:04am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/38 "2019-04-10T00:04:50Z")

</div>

> [@septimus](#):
>
> Just as one hint of what I’m speaking of: “Use the Source, Luke!” was a common mantra in C programming, while making the source of libraries _unreadable_ was seemingly sometimes touted under C++. :smack:

Never heard of that before. Well-written C++ is easy to understand. Easier, in fact, than C. Of course you can run any language through an obfuscator if you don’t want people to read it.

I think there is a mindset difference between languages. I like to know _exactly_ what my language is doing except on toy projects. Is this loop 6 cycles or only 5? (no, I’m not feeling lucky). I was recently reading a defense of the Go language as compared to C/C++, and it listed as features (among other things):

- No pointers
- Bounds-checking on all arrays
- Garbage collection on all memory allocs

Great–that makes it useless for real high-performance programming. I’m sure it appeals to some types, but not me.

---

<div class="post-metadata">

**Author:** ![Folacin](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/folacin/32/3195_2.png) [@Folacin](https://boards.straightdope.com/u/Folacin)\
**Post date:** [April 10, 2019, 1:30am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/39 "2019-04-10T01:30:13Z")

</div>

> [@septimus](#):
>
> Although C and C++ may seem similar, I wonder if they sometimes appeal to opposite personality types! The old-fashioned “philosophy” of C is very different from the “philosophy” of C++. Just as one hint of what I’m speaking of: “Use the Source, Luke!” was a common mantra in C programming, while making the source of libraries _unreadable_ was seemingly sometimes touted under C++. :smack:

When I was learning C++ after years of COBOL, it was obvious that many C/C++ programmers prided themselves on using as few characters as possible, readability/maintainability be damned.

At the time, I heard COBOL referred to as a “read-only language” (as in it was generally easy to tell what a program was doing but there wasn’t a lot the language could actually do) and C/C++ as “write-only” (you could make it stand up and dance if you wanted, but Zeus save the person who had to modify a program (and yes, there is unmaintainable code in any language (see [the story of Mel](http://www.catb.org/~esr/jargon/html/story-of-mel.html), but C/C++ seems to lend itself to the problem)).

---

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [April 10, 2019, 8:12am UTC](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642/40 "2019-04-10T08:12:04Z")

</div>

> [@Dr.Strangelove](#):
>
> > [@septimus](#):
> >
> > Just as one hint of what I’m speaking of: “Use the Source, Luke!” was a common mantra in C programming, while making the source of libraries unreadable was seemingly sometimes touted under C++.
> 
> Never heard of that before. Well-written C++ is easy to understand. Easier, in fact, than C. Of course you can run any language through an obfuscator if you don’t want people to read it.

I phrased my remark incorrectly. I was thinking of a company (or companies?) which sold C++ object libraries and did not provide source code. The absence of source code was billed as a feature — “You don’t want your dumb programmers to even think of messing with this!”

I stand by my main point: Despite strong similarities, C and C++ have almost _opposite_ philosophies and may appeal to programmers of opposite temperament. I’m afraid my temperament is strongly of a low-level DIY bent, so I don’t think I can offer any objective judgement on these languages. :dubious:

[Previous page](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642.md?page=1)

[Next page](https://boards.straightdope.com/t/i-found-out-what-i-like-related-to-computer-coding/820642.md?page=3)
