Welcome, Guest. Please login or register.

Author Topic: C/C++ learning  (Read 6543 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
C/C++ learning
« on: February 25, 2003, 11:55:07 AM »
Hi all,

There's been a lot of discussion on programming recently. It seems to be the case that there is much interest (both positive and negative) in C/C++. One thing that was clear to me is that there are quite a number of people who want to learn but are put off for different reasons.

Something Atheist wrote, suggesting you won't learn from a message board got me thinking. Does anybody think a series of posted tutorials in C/C++ would be useful for those interested?

Assuming some C/C++ coders could find the time to organise it, that is...

I got thinking, each tutorial could be a seperate thread and people could post their queries on that topic rather than a large monolithic thread. The basic rules would be that questions are answered (where possible) and no arguing over semantics and C vs BASIC etc :-), unless it clarifies a point relevent to the subject matter.

Once the language is covered, those with the relevant expertise could introduce Amiga specific coding.

I wouldn't mind contributuing to a such a project if it could be organised.

Suggestions?

Peace out,
K
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: C/C++ learning
« Reply #1 on: February 25, 2003, 03:20:07 PM »
Quote

Themamboman wrote:
How about C++ tuts specifically aimed at Amiga programming?


Well, I feel that just learning C/C++ would be better for the majority of would be recipients.

Once you know a language well, understanding the SDK for a platform is often a good deal easier anyway.

If you get into C++ big time, then like me, you'll probably find that you tend to abstract away the AmigaOS dependent stuff behind your own preferred classes anyway ;-) All of which helps more than you might realise. A fully debugged Window class that encasulates your basic intuition window can save you lots of time later when you want to write another app and can't be bothered having to recode all the window/event handling stuff!
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: C/C++ learning
« Reply #2 on: February 26, 2003, 09:52:39 AM »
Hi Sidewinder,

That's an interesting site you got there. Nicely laid out and easy to nagivate.
I do have one or two comments if I may be so bold. Also this isn't intended to be a criticism, just observation...



I hope you don't think I'm being to picky, but according to the ANSI 2.0 C rules, either you do not define the signature of main(), or if you do define a return type/arg list, you should also specify a return value, else it goes undefined:

either (old style)

#include
main() /* no signature */
{
   printf("Hello World\n");
}

or (preffered as of 1999 amendment)

#include
int main() /* returns int, no args passed*/
{
   printf("Hello world\n");
   return 0;
}

Using 'void' to signify no arguments is depricated (behaviuor adopted from C++).



Back to tutorials, I do feel that there is a bit of a leap for beginners moving from 'hello world' to opening an intuition window in the second lesson. I realise that it was a demonstration only, but could look quite daunting to those new to the language.

Well, enough said - youre probably ready to climb through the monitor and kick my ass by now ;-)

Going back to my original post, what I had in mind was something that would introduce the language itself, structured something like this

1) What is C?
     Origin, about compiler v interpreter etc.
     Source code arrangement, #includes etc'

2) Hello world
    The canonical 1st program.

3) Variables & Types
    Variables, types, arrays, enums, constants etc.
    Scope, duration.

4) Operators
     Overview of C operator syntax, precedence rules etc.

5) Programming constructs
    if/else
    switch/case/default
    loops
    goto (and misuse of)

6) Functions
    Procedural programming paragdim.
    Argument passing.
    return types etc.

7) IO
    More detailed look at basic ANSI C IO.
    Formatted IO.
    File streams.
    Binary IO.

8) Pointers
    The dreaded lurgy explained ;-)

9) Structures
    Cocept, uses, arrays of structures etc.

10) Additional topics
    Advanced pointers, function pointers, lists etc, vararg functions, unions etc.

That would basically cover C as a language.

I would begin on C++ only once sufficient C was understood to make sense of what was going on syntax wise. Probably introduce the concept of classes once C structures had been covered and move on from there.

As for AmigaOS specific coding, I would aim to start on that once C functions had been covered and not before.

Disclaimer : All of the above is IMHO ;-)
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: C/C++ learning
« Reply #3 on: February 26, 2003, 11:07:12 AM »
Hi again,

Quote

FuZion wrote:
Karlos seems to have a bit of know how too, for a beginner like  ;-)


Why, ya' cheeky beggar like, erm, I think... :-P

I'm not new to C/C++, though not as knowledgable as I'd like to be, especially when it comes to AmigaOS specific coding and the V3 C++ STL.

Even so, knowing something is one thing, teaching it however, is another matter :-)

I did do a stint as an undergraduate supervisor during the first (and only) year of my ill-fated chemistry PhD. That involved quite a lot of designing tutorials, interactive tuition and the like.

Quote

I like the idea of individual forums on each tutorial too helping to focus on each one individually.


Yeah, I thought that would be quite handy since it gives a degree of interactivity which is often essential for learning. You'd need a few ground rules about off topic posts and stuff, as I mentioned at the start.

Quote

Is there anything anyone can do to make this happen?


I was thinking that it needs a few people to work on it. Maybe Wayne could open up a teaching zone in the forums? That could pave the way for all sorts of handy stuff, everything from AmigaDOS scripting to web design.

Even without that, it wouldn't be too bad just to write a tutorial and post it normally in this forum. I do admit, I've yet to find a way to preserve certian essential formatting such as indentation - it always ends up with the whitespace stripped out after I post!
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: C/C++ learning
« Reply #4 on: March 04, 2003, 10:19:38 AM »
Hi Atheist,

As it happens, I'm thinking of putting together that set of topics I mentioned earlier and banging it up on a free host somewhere. I'd post links to each tutorial (each as its own thread) in this forum each time I add a topic. Questions and (hopefully) answers could then be posted, courtesty of those nice people at Amiga.org.

As for your points about platform seperation etc, my original intention was to give tutorials on the pure ANSI C language so the choice of compiler would be down to the user.

I realise however, this may not suit the absolute beginner (we all were in that situation once), so there will be reccomendations. For example I was thinking StormC v3 is good enough for ANSI C coding, comes on the developer cd v2.1 (which would be useful for Amiga specific stuff later in the course) and has a nice IDE that is friendly enough for the beginner.

Each topics' turorial/example code will be guarenteed (hopefully) to work with the suggested set up (i.e. I'll actually test it myself ;-) beforehand)

People used to gcc etc. wouldn't really have much need for this tutorial site anyhow ;-) It's aimed at all those who want to learn C but are put off for the sorts of reasons that have cropped up in this forum (strange syntax etc. etc.).

Once the ANSI C is covered sufficiently, I'd hopefully introduce AmigaOS specific coding. Unfortunately, this is still something I'm learning myself ;-), so maybe I'll leave this to the experts!

Depending how it goes, I'd want to set up a C++ set of topics of a similar structure (but without the groundwork of the C syntax).

Finding the time is going to be the killer :-D

Suggestions folks?
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: C/C++ learning
« Reply #5 on: March 06, 2003, 09:17:23 AM »
Hi Jahc,

That's what I'm talking about dude :-D
AmigaOS stuff would come after...

-edit-

Also, it wouldn't just be static tutorials, each one would have feedback via (this) forum...
int p; // A