Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« on: February 15, 2003, 02:52:35 PM »
If you have never programmed before then you
should consider using a scripting language to
start with  ( like perl or arexx ) simply because
understanding compiler messages that come back
from coding errors with C or C++ would kill
your enthusiasm real quick.

Once you have got used to the idea of variables,
conditionals and all that gubbis go straight to C,
do not pass BASIC and do not collect PASCAL.

Why?

Because the cross reference for programming Amiga OS calls using any other language than C ( or
C++ if you like to live wild ) sucks.

In fact play with AREXX given it is probably shipped
with your OS. And you might have a manual too....
Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #1 on: February 15, 2003, 04:56:06 PM »
I don't think its fair to call scripting languages
the kiddy pool. No need to give a new programmer
a complex or feel that they won't be respected
until they use a certain language.

Scripting languages are just a bit more accessable.
Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #2 on: February 15, 2003, 05:46:23 PM »
@sidewinder

Im sorry. I guess Im a bit protective of people that
start out programming - Id hate to feel that they
felt second class citizens whilst they are using
scripting languages.
Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #3 on: February 15, 2003, 06:53:51 PM »
I strongly advise you to buy Hisoft C++ rather
than Storm.
Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #4 on: February 16, 2003, 10:43:49 AM »
Quote


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.


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.

Why have a "main"? Well it allows you to define it
where you want - and you can have C "programs" which are not executable - useful in building libraries.

Quote

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.

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.

There is fprintf which is used for printing text to a file descriptor, sprintf which is used for printing text into a string.

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 ).

Quote


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.

Au contraire, it is an extremely logical language. ( indicates start of parameters, ) indicates end of parameters so that you can make parameters span multiple lines.

Why should types be part of their name? What benefit does it give you?

; indicates end of statement. Again this is useful for
multi line stuff but also for single line stuff where
you might want to fit multiple statements into one
line ( for example the use of ; in if and while ).

Automatic includes would break the ability to redefine functions.

I would NEVER recommend AMOS pro and compiler
first because it has a bunch of sucky default requesters that allow everyone to spot an AMOS pro program a mile of ( that and everyone forgets to trap CNTRL-A ) and secondly the add on routines for supporting AGA do not work well into the environment and finally because it does not support RTG by itself.

Lastly, it teaches you sloppy programming habits.
Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #5 on: February 16, 2003, 10:47:12 AM »
HiSoft is better because the IDE is more intuitive
and that is vital for beginners. It also doesnt crash
every five minutes like StormC 3 and 4.

Sure it doesnt support STL out of the box but
then most beginners dont want that.

IT doesnt have RAD Wizards ( excuse me while I suppress my urge to mess my pants with excitement )  but it does have an object library for rapid application development. It has a fine debugger.

Hate figure. :lol:
 

Offline DaveP

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2116
    • Show all replies
Re: How to program: In one easy step... Learn?
« Reply #6 on: February 19, 2003, 01:46:26 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.

No. The signature for main passes in the parameters
argc and argv into your program. In AMOS would you
define a procedure having an variable called 3? In fact
can you even do procedures properly in AMOS yet or
do you have to resort to GLOBAL ?

Quote

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.

It can be called from another program sure enough, but what it
does is tell you in argc how many arguments have been provided
and argv is an array of the strings that have been provided. You
cannot limit what people type into a console. So your program if
you wanted to restrict to just 3 args would say:

int main( int argc, char * argv[] )
{
     if ( argc > 3 )
     {
   return -1;
     }


Quote

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.

In this context, given it is a procedure/function declaration
its a pointer reference. So argv is a pointer to a character array.

Havent got time to answer the rest just yet.
Hate figure. :lol: