Welcome, Guest. Please login or register.

Author Topic: Beginners 'C' programing group  (Read 12682 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline FluffyMcDeath

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 3440
    • Show only replies by FluffyMcDeath
Re: Beginners 'C' programing group
« Reply #74 from previous page: February 15, 2004, 06:14:03 AM »
Quote

iamaboringperson wrote:
Re: Pointers in C

One problem I had when I started learning C, was understanding how functions worked. I could define them etc.  however I treated function calls like 'gosub' or 'goto' in basic.



And also missed out on the joys of function pointers by which you could tell someone else where to goto!!

So, it seems that avoiding pointers is probably a good thing to do for beginners, but programming for the Amiga is riddled with pointers cos they're soooooo useful (especially on slower CPUs when passing large structs by value would be painful).

Another thing that came to mind is the problem of overflow. Since C is pretty close to the metal, it is necessary to know about the number of bits you have in your ints. It's not an arbitrary size and precision environment.

Ooooh, and endianism!!

Oh, and compiler optimizations that blow non volatiles out of your hardware banging code, and ... all sorts of good stuff.

Lot's of gotcha's in C/C++. Still great fun though.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16878
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Beginners 'C' programing group
« Reply #75 on: February 15, 2004, 12:16:55 PM »
@Piru

Whoops, I knew I'd forgotten something :-D I thought about the +1 afterwards and thought "I don't remember - do I need it or not?"...then went to bed :-)

-edit-

It also suggests that this isn't even a beginner mistake ;-) Perhaps I should go join Matt and play with lego in the corner :lol:
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16878
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Beginners 'C' programing group
« Reply #76 on: February 15, 2004, 12:37:01 PM »
Quote

boing wrote:
  I don't think I'll ever like C.  It looks like something created for a parser that was written in one night instead intended as  a quality language.  One can have a great language without the visual ugliness of C. Or it's counterintuitive use of  grammar and math characters.  It's just the most goddamn impossible language tp read through that I've ever seen.


Written in one night? :lol: C has the just about cleanest syntax going. Java, javascript, C++, CF, etc. didn't copy it for fun, you know.

Still, it does look a bit odd at first, but with experience you will actually realise its stuff like BASIC that is unweildy.

Quote

As far as I'm concerned, either use Assembler, or use AMOS or Blitz.  Anything inbetween is kind of pointless.


1) Don't use assembler unless you either (a) don't care at all about portability, or (b) optimising some code for a particular system.

2) AMOS is one of the worst languages ever. Period.

Quote

Having said that, I guess I'd like to revisit C since so much $&^@ documentation assumes you're comfortable with it.  Bastards.  This is what happens when wannabe's outnumber true coders in colleges.


A very mature attitude! A bad craftsman always blames his tools. If you are a 'true coder' as you say and have the mentality for programming (that is analysing problems and devising solutions) you can adapt to just about any language.

Since I studied chemisrty, I learned 680x0/PPC asm, C, C++ and Java entirely in my own time. I also started with a knowledge of BASIC and can assure anybody that moving to C from such a background is far from impossible.

Quote
Still, why waste time with C when C++ exists?


If you can't take C syntax, you don't stand a chance of learning C++
int p; // A
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Beginners 'C' programing group
« Reply #77 on: February 15, 2004, 12:44:13 PM »
Quote
Since I studied chemisrty, I learned 680x0/PPC asm, C, C++ and Java entirely in my own time. I also started with a knowledge of BASIC and can assure anybody that moving to C from such a background is far from impossible.
Which remindes me that in one course I took, we had to program in C for a couple of the digital electronics modules. (Interfacing with hardware we assembled)

C is not just a language that 'programmers' who are employed to only program use. It's probably used in many other professions also. I could imagine that electronics engineers these days probably couldn't get very far without a little programming experience.

And C is probably the best language for scientific use.
 

Offline Kronos

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: Beginners 'C' programing group
« Reply #78 on: February 15, 2004, 12:59:17 PM »
Quote

iamaboringperson wrote:
Re: Pointers in C

Recursion I think is a fairly advanced subject, the only use for it that comes into mind at the moment (although there are many more) is traversing binary trees etc.



Or for drawing bezier-curves that are precise, but won't waste precious cycles by
creating to much points .......

 :-x  :-P  :-o  :-D  ;-)  :roll:  :evil:  :oops:  :-P  :-x  :idea:  :madashell:  :griping:  :boohoo:
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline blubbe

  • Sr. Member
  • ****
  • Join Date: Apr 2002
  • Posts: 268
    • Show only replies by blubbe
    • http://somewhere.in-hell.com
Re: Beginners 'C' programing group
« Reply #79 on: February 15, 2004, 02:31:10 PM »
Quote

Written in one night? C has the just about cleanest syntax going. Java, javascript, C++, CF, etc. didn't copy it for fun, you know.

Still, it does look a bit odd at first, but with experience you will actually realise its stuff like BASIC that is unweildy.


The C-syntax was copied because it is what most
programmers are used to already.
Syntactically its a piece of ***.
And lets not talk about C++.

No, C has other things going for it:
Lots of Examples,documentation,books,teached in schools,
and implementations on every possible platform.

A bit like Windows :)
Edit:
[if you disregard implementations on every platform :)]


i      i     i    i   i  i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i  i   i    i     i     i      i
 

Offline AmiGR

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 698
    • Show only replies by AmiGR
Re: Beginners 'C' programing group
« Reply #80 on: February 15, 2004, 03:11:57 PM »
Excuse me? The fact that you don't like C's *logical*
syntax doesn't make it #OOPS#. The fact that boing prefers
AMOS' syntax over C's just makes him crazy:-)
- AMiGR

Evil, biased mod from hell.
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Beginners 'C' programing group
« Reply #81 on: February 15, 2004, 09:34:33 PM »
Quote
The C-syntax was copied because it is what most
programmers are used to already.
Oh dear..

No, it's copied because that's what programmers prefer

Quote
Syntactically its a piece of ***.
And lets not talk about C++.
Both are great languages

What language do you prefer?

Don't tell me Pascall.... or BASIC.... or *eeck* COBOL...

Excluding the look-a-like clones, C is the most structured and best designed programming language out there.

 

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show only replies by Cymric
Re: Beginners 'C' programing group
« Reply #82 on: February 16, 2004, 03:20:23 PM »
Quote
Karlos wrote:
@Cymric
Fluffy isn't wrong, he is saying when you understand pointers properly, you know *why* the code he presented is so screwed up.

Yes, and that's precisely what I had in mind when I wrote my message. I wasn't trying to point out that he had made those mistakes unknowingly, I was trying to tell him (or her) that I saw how many errors he had deliberately introduced without giving away what they were. Plus expressing my consent that it's easy to shoot yourself in the foot with pointers. Hope that clears up some confusion!
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.