Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > To go with Go or C/C++?

Reply
Thread Tools

To go with Go or C/C++?

 
 
Bo Persson
Guest
Posts: n/a
 
      05-02-2013
Tinxx skrev 2013-05-02 13:30:
> I think I start with learning C and play around with C calling Lua and vice versa. Maybe some DI framework for C where the configuration definition language is Lua. Might have been done a zillion times before, but it's for fun and learning and you first have to be able to walk before you want to fly. Knowing plain C is always useful, because C++ is sometimes an overkill or not the appropriate choice. Then I do some socket programming with zeromq.org first with C and later with C++. This way I can slowly fight my way up at the pace I have time in my spare time.
>


Right, if you want to learn both C and C++ (and Lua), just do that.

We are just saying that learning one doesn't help much in learning the
next one, because you will also have to unlearn what you just learned.
So the order is of less importance.


Bo Persson


 
Reply With Quote
 
 
 
 
Stefan Ram
Guest
Posts: n/a
 
      05-02-2013
Bo Persson <(E-Mail Removed)> writes:
>The problem is that you have to forget A LOT of C, like
>printf and scanf


There are indeed some experienced C++ programmers
who prefer to use C-style I/O in C++.

>C string handling
>pointers and arrays
>pass-by-pointer instead of pass-by-reference


Even in C++, one writes:

int main(int argc, char* argv[])

, which requires to understand meaning and encoding
(NUL-termination of char-*-strings) of argv,
including pass-by-pointer and arrays.

>that << and >> are some odd bit shifting instead of I/O operators


Even a C++ programmer needs to understand ((1<<14)|(1<<2)).

>How much time have we lost after learning all this?


C is the most popular language according to Tiobe.
Twice as popular as C++, which is declining in popularity.
How is learning the most popular and most influential
language a loss of time?

 
Reply With Quote
 
 
 
 
Rui Maciel
Guest
Posts: n/a
 
      05-02-2013
Bo Persson wrote:

> We are just saying that learning one doesn't help much in learning the
> next one, because you will also have to unlearn what you just learned.


Nonsense.


Rui Maciel
 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      05-02-2013
Bo Persson wrote:

> The problem is that you have to forget A LOT of C


Nonsense.


Rui Maciel
 
Reply With Quote
 
Bo Persson
Guest
Posts: n/a
 
      05-02-2013
Stefan Ram skrev 2013-05-02 18:49:

> C is the most popular language according to Tiobe.
> Twice as popular as C++, which is declining in popularity.
> How is learning the most popular and most influential
> language a loss of time?
>


Popularity according to Tiobe is the language producing most noise on
the Internet. Arguably it is the one that is hardest to use that
produces the most questions.

If you WANT to learn "the most popular language", just do that. If it is
just a prerequisite for learning the other language, it is a waste of
your time.


If I want to learn to ride a bicycle, I wouldn't start with a unicycle
just because it looks easier.



Bo Persson

 
Reply With Quote
 
Bo Persson
Guest
Posts: n/a
 
      05-02-2013
Scott Lurndal skrev 2013-05-02 19:06:
> Bo Persson <(E-Mail Removed)> writes:
>> Gerald Breuer skrev 2013-05-01 20:44:
>>> Learn C first because you need a magnitude of time less to learn.
>>> Then learn C++ and forget some idioms of C-programming.

>>
>> The problem is that you have to forget A LOT of C, like

>
> Why? It all still works in C++. That's a benefit.


No, it's a big disadvantage because C++ has better tools for this. Why
not learn them first?

Try

std::string s = t;

over

char * s = malloc(strlen(t) + 1);
strcpy(s, t);

// and much later:

free(s);

and guess which is easier to learn (without missing the meaning of the
+1, or forgetting the free).

>
>>
>> printf and scanf
>> C string handling
>> pointers and arrays
>> malloc and free
>> inventing odd names instead of overloaded functions
>> typedef struct
>> prefixed names instead of namespaces
>> pass-by-pointer instead of pass-by-reference
>> that << and >> are some odd bit shifting instead of I/O operators

>
> And here you are joking, right? Or do you truely think that bit shifting
> and C++ don't mix?
>


No, but I believe a new student shouldn't START there. You can learn
that later, if and when you need it.


Bo Persson



 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      05-02-2013
On Wednesday, 1 May 2013 15:44:05 UTC+1, Stefan Ram wrote:
> Tinxx <(E-Mail Removed)> writes:


> >Now I regret never having done any systems programming and I
> >would like to dig a bit into it in my spare time. So I have
> >to pick a language and I was looking at C/C++, D, and Go.


> C is much easier to learn then C++.


I would argue about that. Learning all of the formal aspects of
the language, yes. But knowing all of the formal aspects of the
language doesn't mean that you know how to write robust,
maintainable programs in it. And it's a lot easier to write
robust, maintainable programs in C++ than in C.

--
James
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      05-02-2013
On Wednesday, 1 May 2013 21:57:19 UTC+1, Gerald Breuer wrote:
> Am 01.05.2013 21:37, schrieb Victor Bazarov:


> C++ is a complicated language and learning C++ right from the
> start might be too difficult and the learning curve may be too
> steep for the novice. So it's educational meaningful to learn
> the basic concepts of C which also apply C++ also first.


Learning C right is more difficult than learning C++ right.
Writing efficient, robust, maintainable applications in C is
very, very difficult.

--
James
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      05-02-2013
On Thursday, 2 May 2013 18:23:37 UTC+1, Bo Persson wrote:
> Stefan Ram skrev 2013-05-02 18:49:


> If I want to learn to ride a bicycle, I wouldn't start with a unicycle
> just because it looks easier.


Beautiful. The analogy is perfect: C is a unicycle, C++
a bicycle, and Java a tricycle.

--
James
 
Reply With Quote
 
Stefan Ram
Guest
Posts: n/a
 
      05-02-2013
James Kanze <(E-Mail Removed)> writes:
>maintainable programs in it. And it's a lot easier to write
>robust, maintainable programs in C++ than in C.


I am not sure about this. For example, exceptions introduce
so many hidden paths into a seemingly simple piece of code
in C++.

http://www.gotw.ca/gotw/020.htm

In C, one can write

if( f = fopen( "file", "r" )){ use( f ); close( f ); }

, i.e., apply the well-established style of structured
programming. Without exception, we do not need no RAII,
we can assert that close will be executed iff the file
was opened successfully.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unicode issue with Python v3.3 33 Python 80 04-19-2013 07:16 PM
newbie: Problem with $ and \ in strings vivek_12315 Perl Misc 2 04-12-2013 08:30 PM
name lookup failure using metaclasses with unittests Ulrich Eckhardt Python 7 04-12-2013 02:58 PM
Re: print to screen and file with one print statement amiwinter@gmail.com Python 0 04-09-2013 01:31 PM
USBLock : lock/unlock your computer with a USB key Sven Python 0 04-08-2013 03:21 PM



Advertisments