Jump to content
  • Advertisement
Sign in to follow this  
ildave1

Programming Topics that are/are not relevent [solved]

This topic is 4887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

From your experiences as a programmer, what kind of major topics are in books these days that are not really a -need- of focus and what topics should a new user disregard? Example: C-style Character Strings It even writes in the book (C++ Primer, 4th Edition), "Although C++ supports C-style strings, they should not be used by C++ programs. C-style strings are surprisingly rich source of bugs and are the root cause of many, many security problems." Half of me wants to skip this part, and half wants to just say, "Just read it!". However, I really dont want to learn something I will never use (because they may have a different/better way to do the same thing that I may learn later). I am just trying to find out from a first hand view, what topics do you believe a new guy to the language should FOCUS on and what topics a new guy should not worry about reading right now. [Edited by - ildave1 on July 28, 2005 12:57:42 PM]

Share this post


Link to post
Share on other sites
Advertisement
If you are talking about fundamental C/C++ topics you should learn everything, even C-style character strings. Even though you try to only use std::string you will probably some day use an API that uses C-style strings (Win32 or MFC for example).

/roq
http://roq.blogspot.com

Share this post


Link to post
Share on other sites
MFC uses CString.

In the beginning of your c++ skills you'll use a lot of c, that is not bad and it may be even easier for you than using a lot of complicated classes.
In the book "the c++ programming language" is said that it's ok to use c++ as a better c and with more experience to use more advanced ways to express something in c++.

So using c strings in the beginning is ok, because c++ doesn't know something else, there is only a class that makes the handling easier.

There is no way you can do something wrong as long as you are learning. The only wrong thing is to give up learning.
If a topic is too complex at the moment just skip it and come back at a later moment than it'll be much easier for you to learn it.
For example templates are a very complex topic and you don't need them, they make life just easier (or harder ;)) if you're an advanced c++ programmer.

Share this post


Link to post
Share on other sites
err I think he means "c string" as in char* rather then MFCs infamous CString.

There will always be a place for directly manipulating buffers of characters, as sometimes they aren't human readable - rather they are some kind of other data that can be conviently represented that way, but using an stl string would not make sense. Plus it is a common way of getting data across to different apis, like win32.

Though in most cases if you can use std::string then I reckon you should.

as for learning, it's always important to seek out a pratical application of whatever you are learning so it sticks in your head. If there are exercises at the end of a chapter you are not sure of, you should try and attempt one or two.

Share this post


Link to post
Share on other sites
Quote:
Original post by ildave1
From your experiences as a programmer, what kind of major topics are in books these days that are not really a -need- of focus and what topics should a new user disregard?

A new user should read them all. Better to learn about something that shouldn't be done, than be ignorant of it. Later on, as you have a basic idea of everything, you should be able to determine which parts are worth learning about in more detail. But make sure you know the basics of everything.

Quote:

Example: C-style Character Strings
It even writes in the book (C++ Primer, 4th Edition), "Although C++ supports C-style strings, they should not be used by C++ programs. C-style strings are surprisingly rich source of bugs and are the root cause of many, many security problems."

Generally true, but there's a world of difference between "should not be used", and "Is not used". (as well as "Can occasionally be useful").
C-style strings are very widely used in different API's, and I can guarantee you'll have to deal with them, whether or not they're ugly and bug-prone.

Share this post


Link to post
Share on other sites
The way I look at it is that it is at least good to know about them. I have the insatible hunger to learn everything though which is probably why I still know very little;)

Share this post


Link to post
Share on other sites
Heh, I'd say learn what they're about, but in practice you'll probably use std::string::c_str more often than busting out your own null-terminated-character-arrays.

Share this post


Link to post
Share on other sites
char *'s come up enough, that I think it's important to know how to use them. Given their bugginess, I think it's even more important to know what you're doing, since using them without knowing them will lead to badness.

Quote:

I am just trying to find out from a first hand view, what topics do you believe a new guy to the language should FOCUS on and what topics a new guy should not worry about reading right now.


Probably in the back of your book is stuff about the Standard Library. You should focus on that. Further, you might want to look at that -first- before many other things in the book, since non-trivial uses of classes/pointers/inheritance/templating often need resources the Library provides to be effective. The majority of the posts in these forums are from people stuck on those sort of infrastructure pre-requisites, not the actual stuff they should be learning.

Certain things, like unions, enumerations and arguably namespaces and exceptions could be passed over in your first run through the book. Namespaces and exceptions though are useful, though generally only are useful after you've a solid understanding of the rest.

Share this post


Link to post
Share on other sites
Hey everybody!

Thank you all for your feedback on this question. I just wanted to jump out and ask everybody how they felt about situations like this, but regardless I believe I will read through the entire book just so I can get a general idea. So, later on when I run into something, it will look familiar.

Thanks Again Everyone.

Share this post


Link to post
Share on other sites
Quote:
Original post by paulecoyote
[...]Plus it is a common way of getting data across to different apis, like win32.
[...]

For std::string and std::vector that isn't needed because both are made 100% C compatible, so you can pass the adress of the first element (or another element) to a function that requires a c-style string or an array.



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!