Welcome, Guest. Please login or register.

Author Topic: How to program: In one easy step... Learn?  (Read 11177 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« on: February 16, 2003, 09:03:20 AM »
Quote

Sidewinder wrote:
I would suggest that you take a look at StormC 4 from Haage & Partner.  Currently they are running a special when you can get StormC 4 for only 50 Euros (about $50).


Man, what a great deal, but because of the Amithlon fiasco, I thought we were in boycott mode. I was even thinking of getting it, but I despise C.

Amiga! How long must we suffer?
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #1 on: February 16, 2003, 09:25:38 AM »
Quote

Sidewinder wrote:
If you are looking for a quick tutorial on starting Amiga sepcific programming in C you can stop by my tutorial and start reading.  C or C++ is really the only way to go on the Amiga right now if you want to get some serious work done.  Starting with a scripting language (as was already suggested) is also a good place to start.  It really depends on your style of learning.  If you want to jump into the deep end and learn to swim that way learn C.  If you're more comfortable in the kiddy pool at first then go the way of a scripting langauge.



Lets see; Lesson 1
------------------------
#include

int main(void)
{
    printf( "Hello World!\n" );
}
------------------------------

I always reccommend Amos Prfessional & Compiler because I have a problem with C.

int main(void)

Why is that statement necessary? I read your page, and there is no real reason for it. Instead of void, what if I put in 9? I mean you say if it's not there it won't work, but does nothing, and yet every company that writes a compiler, won't remove the necesity to place it in the program.

Then there's

#include

I don't see a reason for that, other than every company that makes a compiler, won't remove the neccesity for it. If you don't use it, you can't print on the screen, yet if you use the print statment, clearly  you want to print something, so logic clearly dictates that it HAS to be there, so, programming, being based on logic, should INCLUDE include AUTOMATICALLY, and yet again, no SW company will do the logical choice and automatically include, include, if you use the print statement.

Also, I find it annoying that lines have to be ended with  ;

Therefore, these annoying things, many others, prevent me from using it. I don't want to memorize, if I use "if...then", maybe I need another #include, or it won't work. It should be handled automatically. I don't like listing variables, their type should be part of their name (i.e. $ is string, % is binary, etc).

printf( "Hello World!\n" )

I totally don't see a necessity for ( ) and " ", when basic easily survives with just " ".

It isn't a logical language.

Amiga! Can't wait to continue with Amos on A1.
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #2 on: February 19, 2003, 12:20:13 PM »
Quote

DaveP wrote:
It defines the entrypoint to your program. void means
no arguments are supplied. The real signature is

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

where argc is the argument count and argv is an
array of the strings passed to the program on invocation.


So if I put "int argc"  as  "int 3"
It would accept up to 3  words or numbers, in addition to the name of the cammand, from the shell prompt? Or from being called from another program.

char*argv

This looks like you are multiplying the terms.
Or, are variable names supposed to be placed between the square brackets? I don't get it.


Quote

Because there are different methods of printing. stdio just happens to be one place where printing to the screen is implemented. In fact it contains all console I/O functions that write to stdout, stderr and read in from stdin.


When you say, it contains all console functions, the compiled program only gets the portion needed, right?

You see, what gets me is, every time you want to use a command, you have to find the include that matches it.

Quote
sprintf which is used for printing text into a string.


??? you mean like  A$=Inkey$

Quote

C is a language with no built in functions you see. It has basic types and operators. This allows you to re-define printf somewhere else ( say make it print to a graphical window ).


Amos    Screen 4


Quote

and secondly the add on routines for supporting AGA do not work well into the
environment


Well, Francois Lionet, never got around to doing an AGA version.

Quote

Lastly, it teaches you sloppy programming habits.


I can see this being a problem.

I don't know if I'll ever be able to understand what "building a library" means.

I know about half of the Amos commands, but never got a hang of Amal. The awful thing is Amos, even compiled, could never be as fast as C. Nor can you force the computer to do certain things with it. I have a program that 500k in size. 2/3 data statements. I know that I wouldn't have a clue where to start converting it. Especially since, I've looked at programs a couple of pages long, and even knowing, the if then, while, ;, commands, its unreadable. Maybe I don't have what it takes.

Well, at any rate, which C. People say C, C++, then there's ANSI C (and maybe ANSI C++). Is ANSI the name of a company, like Storm is?

I've always considered taking a chance at using it.
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #3 on: February 20, 2003, 07:00:33 AM »
Quote

Karlos wrote:

...and nothing you ever write will work the moment you shove an accelerator, extra memory, hard disk,


I don't know what you mean by the extra memory. Amos worked when I only had chip ram, and it worked when I got both. I don't have the compiler thogh, but am getting it soon. I know it's free, but I found a store that had it on the original disks, and am waiting to see if it's still available. (Professional Comp)

Are you saying that when Amos Professional, compiles a program, it won't work on what 020, 030...?

If Francois Lionet created a new "library", could it compile to the G4's?

Amiga! Aminet 2.0(4.0) is coming!
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #4 on: February 20, 2003, 07:22:33 AM »
@ Karlos

1) I find it surprising that the first string is the name of the program itself. Was that correct?

2) I don't get this stuff; I see
For____without a___next
Return___without a____gosub
Return 0____0 what?

You see, it's too cryptic, I didnt' know "argc" was a name for a number, and that I could have put in its place "word_number". I did realize it meant integer though.

3)i++____increment by 1
i++2_____increment by 2?

4) So, is there an ANSI C++?
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #5 on: February 20, 2003, 07:36:58 AM »
Quote

Karlos wrote:

   puts ("All done!");
Quote


Why were you using
Printf("text")

Then

Puts("Text")

???


argv[]____could I have used____word[]
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.
 

Offline Atheist

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 820
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #6 on: February 21, 2003, 03:42:15 AM »
@ Karlos
Well, this is interesting. I understood all the things you said. I've yet to see a book that actually spells it out like that. It seems to me it was deliberately made that way to keep people away from programming.

Like, they could have structured it
For x=1 to 6 step 1
Print X
Next x

instead, and the compiler would just work it out. I can read the above code.

The answer to 1 is really neat, it means you could check to see if someone renamed your program. Sometimes you need to know everthing.

Thanks for the output. Obviously I'm not going to learn C on a message board, but one last important thing.

1) Have every type of C (C, C++, ANSI C and ANSI C ++) been made for Amiga?

2) No RKM's (books) are available for 4.0. Now no custom chips exist. So, the libs: directory will be completely rebuilt for the G4. Do you need 2 different compilers, one for G3, and 1 for G4?

3) I suppose I would need to buy an SDK to get that library information, before I could program in (any) C?

4) Does one need RKMs to program in ADos 1.3, 2.04 etc.? Can you make 1 program, that will take advantage of a CPU, whether it's just a 68000, or  a 68030 etc.? Or are separate versions always needed?

We REALLY need to stay with 1 CPU.

For instance, now a C is needed to access the altivec component of CPU's.

Amiga!
\\"Which would you buy? The Crappy A1200, 15 years out of date... or the Mobile Phone that I have?\\" -- bloodline
So I guess that A500, 600, 1000, 2000, CDTV, CD32, are pure garbage then? Thanks for posting here.