Welcome, Guest. Please login or register.

Author Topic: Learning C with the Amiga  (Read 32630 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« on: January 28, 2007, 07:50:42 PM »
Quote
To make things a bit more complex: the above mechanism works only for programs you start from the CLI. For programs which start from the Workbench, you will need to use a different and much more Amiga-like mechanism. For now you can ignore its existence, but remember that you need to perform a bit of special processing if you want your program to be double-clickable.

Small correction: standard Amiga C startup code does handle WB startup just fine. Any output will open a console window. When started from an icon, argc is 0.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« Reply #1 on: February 08, 2007, 08:30:23 AM »
@AJCopland
Quote
Now that should teach you to structure code. By structure I mean that you'll make a conscious decision to implement things in a particular way and in a methodical manor as opposed to other languages where you implement things in a certain way... because it's the only way that the language will let you.

Amen to that (and the rest of the message). Well put.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« Reply #2 on: February 08, 2007, 08:37:34 AM »
Well yeah, it's quite pointless to hand optimize bubblesort in assembler, when you could have just replaced the algorithm with quick- or mergesort. ;-)
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« Reply #3 on: February 09, 2007, 02:06:28 PM »
@falemagn
Quote
What's more, too many comments clutter code. I want to see the code, I've grown a sense of aestethic towards code, so much that even if code I write works, and does so well, I keep adjusting it till it looks "beautiful", in the same sense as a well written and thought out mathematical equation can be "beautiful".

Self-descriptive code makes code beautiful.

Spot on! My heart bleeds when I see badly indented or formatted code, or something that is done overly complex way while simpler and more obvious code would be possible. I want to manually recode it just to make it more pleasing to the eye (and faster to execute, but that often is the consequence of the beatification anyway).

I often spend hours reading thru code written by others and at the same time review it, but it's more like reading a novel than labouring. Occasionally I do spot a bug and fix it, but most often I just look out for neat code snippets of code or for some fresh ways to implement some particular task. Programming is constant learning, and while I've programmed for over 20 years now, I still learn new things.

This is no language thing, I did the same with assembler already.

I guess this is the definition of a geek of a sort. Oh, and sorry for the OT,  again. ;-)
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« Reply #4 on: February 12, 2007, 10:08:06 AM »
Quote
Pointer stuff is prone to errors, no doubt about it.

With correct typing I don't see this as a particular problem. There are several coding practices that reduce the change of making mistakes like that. Sure, it is well possible to screw up with pointers, but other languages have these aswell. I don't see this in any way weakness of C language.

Quote
You are always poking around in memory you are not supposed to be poking around in. There is no language-supported checking on this type of error, which was again my point.

There are tons of very nice standardized string libraries that provide dynamic and flexible string handling. You're not forced to use them however, the language doesn't enforce anything on you. Which is the point Jupp3 tried to make, I believe.

Quote
As to the system dependent stuff: If I want to code something which uses threads, and has to run on an Amiga, Windows, and Linux, I'd have to write separate threading modules for use with each operating system.

Well if you insist. I'd just use POSIX Threads library and be done with it.

C is nice since it doesn't restrict or limit you in any way if you prefer it that way. Still, you can use some very high level libraries that make your life very easy. The choice is yours, not something enforced by the language itself.

I'm not saying Python, or Ruby or other language sucks, these do have their applications. I say: Use whatever tool that fits your task. For me, C is the tool of choice.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« Reply #5 on: February 12, 2007, 12:24:00 PM »
@mel_zoom

Nah, it's just a case of a holy war. ;-)