Bad Advices

Pages: 12345
Well, what if you're on a machine that doesn't have support for the standard library (Very low level)
Then you're not using C++.
Standard library != C++.

EDIT: I get it. Not saying C++ is low level, but if you're using it for something lower level.
Last edited on
closed account (S6k9GNh0)
RAII isn't part of the STL if that is what is implied.
In a lower-level environment, an overhelming majority use C. In the case of Linux, C with heavy use of GNU extensions (only for optimization purposes not in the C standard). However, in low-level C++, you generally do not have the STL or the standard C/++ functions. But the way you program in a restricted, low-level environment is much different from how you program in a higher-level manner as things like memory allocation and IO are dealt with differently. In this forum, unless specified otherwise, it's probably best to assume that you're in a common environment with a capable standard library and STL implementation.
C is a better tool for that job. I was jus' sayin'.
Lumpkin wrote:
Well, what if you're on a machine that doesn't have support for the standard library (Very low level)
ResidentBiscuit wrote:
Then you're not using C++.
That really bothers me - saying that a lack of standard library support means the compiler is not a C++ compiler is really absurd, since you can basically plug-and-play with any of the popular standard library implementations or have no standard library at all (you can do plenty of things without including standard library headers).

I know technically you're 100% correct but it just seems over the top absurd. As a suggestion, if you had injected the word "technically" after the first word in your statement, it would greatly reduce the absurdity and still retain the same meaning.
Last edited on
> Well, what if you're on a machine that doesn't have support for the standard library (Very low level)

>> Then you're not using C++.

Both the C and the C++ standards define a formal separation between the programming language and its standard library by specifying two different kinds of conforming implementations.

In both, a hosted implementation is an implementation with full support for both the language and its standard library. A freestanding implementation is one with language support, but no support the standard library (except for a few language-support headers). This is the kind of environment fairly common in low-end embedded systems.

Two kinds of implementations are defined: a hosted implementation and a freestanding implementation. For a hosted implementation, this International Standard defines the set of available libraries. A freestanding
implementation is one in which execution may take place without the benefit of an operating system, and has an implementation-defined set of libraries that includes certain language-support libraries - IS



> RAII isn't part of the STL if that is what is implied.

This is an absurd statement. RAII is a programming idiom.

An idiom that is pervasive in every well engineered C++ component (including those in the standard library); the usage of which is supported and encouraged by every well designed C++ library (including the C++ standard library).
My question is:

If programmers can't agree what constitutes using C++ (ie not using OOP or STL is said to not be using C++), then how can there be a proper list of good and bad advices?
Last edited on by closed account z6A9GNh0
closed account (S6k9GNh0)
There is a yes and no of what "constitutes using C++".

@JLBorges, If you look at what Lumpkin said, it isn't strange for one to come to the conclusion that that is what he thinks.
computerquip wrote:
There is a yes and no of what "constitutes using C++".

Apparently not though. All the books I've ever seen, both beginner and college course C++ books cover the basics of C++ which are really just C for the most part, but they all say it is C++. Not to mention if you do the "hello world" code, they say you are a C++ programmer.

This is why I asked the question, because according to books 'hello world' is a C++ program and you are a C++ programmer if you code it. Yet those with years of experience say if you aren't using OOP and STL then you aren't using C++ and aren't a C++ programmer. This raises another question though, if not using STL and OOP means you aren't a programmer, then how can telling people to use vectors be considered bad advice since arrays are from C?

I've always wondered this because I see these kinds of contradictions every day. I've also seen them turn into attacks on people, myself included. I used to do static tilemaps with simple 2D arrays (tiles[][]) and was told repeatedly by game programmers that I wasn't a C++ programmer because I used C arrays instead of vectors. If it had been one or two I would have passed it off as ill-informed programmers that thought they knew everything, but I see it more today to use vectors in game maps.

Okay, so if there is a definite answer to "using C++" does that mean everyone that learns C++ (data types, return types, variables, functions, input/output) before classes, STL, OOP and advanced topics is actually just a glorified C programmer until they tackle OOP/STL? :(
Apparently not though. All the books I've ever seen, both beginner and college course C++ books cover the basics of C++ which are really just C for the most part, but they all say it is C++.

So you think:

1
2
3
4
5
6
7
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello world!" ;
}


is mostly C?


Not to mention if you do the "hello world" code, they say you are a C++ programmer.

I don't know of anyone who thinks copying code makes you a programmer of any sort.


Yet those with years of experience say if you aren't using OOP and STL then you aren't using C++ and aren't a C++ programmer.

If you aren't using OOP to some degree, and you're in a non-embedded environment and eschew the STL for reasons that don't involve legacy code, you are clearly not using C++ to it's full potential; that doesn't mean you're not using C++. I don't understand why you get hung up on these trivial non-technical assertions unless you're just trolling. Use common sense.

[Edit: grammar.]
Last edited on
No, I'm artistic when it comes to my trolling. Though, I've seen the same assertions for the 17 years I've been programming.
cire wrote:
I don't know of anyone who thinks copying code makes you a programmer of any sort.

You have really got to be careful with how you word things. With that line, one could possible be taken as every person learning to program isn't a programmer because they have to copy the code into their editors in order to learn how to use it and learn how the language features work.
cire wrote:
I don't understand why you get hung up on these trivial non-technical assertions unless you're just trolling. Use common sense.

I'm not hung up on it. I was brought up to question everything and was always told there are no stupid questions. Yet, the reply "use common sense" would make a person feel like they asked a stupid question.

I brought up the point of not being a C++ programmer because I see it played out repeatedly on IRC. Just two days ago I saw a kid come in to a game dev channel I'm on asking about game dev in C++. A channel regular came off with "you aren't really doing C++ until you get into OOP" then told the kid it could take months before getting to that point. Kid just said "forget it", but popped up in the python and pygame channels a few days later. I was glad to see, that while the kid gave up on C++, he at least didn't give up on programming altogether.
closed account (z05DSL3A)
BHXSpecter wrote:
If programmers can't agree what constitutes using C++ (ie not using OOP or STL is said to not be using C++), ...
If you take a C++ compliant tool chain, feed it with your source code, and it comes out the other side with no errors and a nice shinny executable, then you are writing C++. How can it be anything but that simple?
closed account (Dy7SLyTq)
what if i write this though and save it as hello.cpp? would that be considered c++

1
2
3
4
5
6
#include <stdio.h>

int main(int argc, char *argv[])
{
	printf("Hello, world!");
}
closed account (z05DSL3A)
would that be considered c++
Will it build cleanly with a C++ compliant tool chain?
closed account (Dy7SLyTq)
from my brief readings of toolchains, yes it will
closed account (S6k9GNh0)
Considering that C++ is designed to be backwards comopatible with C, it's viable to claim that some C code can also be considered C++.
> I brought up the point of not being a C++ programmer because I see it played out repeatedly on IRC

So?

I click with my mobile phone. Does that make me a photographer? Technically, yes.

If I go to a specialized photography forum on the web, and talk about the pictures I have taken, would some there tell me: 'you are no photographer'? Yes; if someone does not tell me that, either that site is not worth visiting or the people there are too damn polite for their own good.

If someone does tell me that, would I be mortally offended? No; not unless I suffer from delusions of grandeur.
Last edited on
A channel regular came off with "you aren't really doing C++ until you get into OOP" then told the kid it could take months before getting to that point.


I had someone tell me the other day that "you haven't really lived unless you've bungee-jumped." I have not bungee-jumped, but I am certainly "really" living and "really" have been for quite some time, nevertheless I can take his meaning without interpreting the statement in a literal fashion.

Use. Common. Sense.
The full quote from him (and I've seen his sentiment voiced in other forms):

well you aren't really doing C++ until you get into OOP. the basics of C++ are identical to the basics of C. all the books that claim they teach C++ in truth teach C until it gets to classes then it is C++. so only one-third of a C++ introduction books is actually C++.


You have to remember this was said to a beginner in the channel. Since there are still people that say you have to learn C before C++ and still a lot of sites falsely say you have to learn one before the other. In this regard, his argument would, using common sense, sound reasonable to a beginner. Like I said though, I've seen this argument numerous times and worry that beginners will be deterred by it like that kid was.

Well common sense tells me, that a beginner hearing that and having never learned the language will falsely believe anything you tell them about the language.

I only questioned everything I had heard after a friend of mine going for BS in CS at IU said his instructor said that there is no difference between C and C++ when learning the basics (data types, variable naming, functions, etc.) and that cin/cout and printf/scanf are the exact same under the hood. Then before I started posting my comments I was told it again by a former teacher in a different IRC channel I frequent. All that just made me start questioning what I had learned over the years. I may have 17 years experience, but that doesn't mean it was 17 years of 100% accurate information.
Pages: 12345