Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Beginners 'C' programing group
« Reply #29 on: February 12, 2004, 11:48:30 PM »
I guess he did, too :-)
int p; // A
 

Offline BigBenAussie

  • Sr. Member
  • ****
  • Join Date: Feb 2004
  • Posts: 313
    • Show only replies by BigBenAussie
Re: Beginners 'C' programing group
« Reply #30 on: February 13, 2004, 12:24:11 AM »
Look, guys.. I think its great to learn C and all, but doesn't it really depend on what kind of project you want to work on?

Writing games and programs where you are trying to push performance to the limits may benefit from C which compiles to the native system better than C++ and tends to run faster.

However, I would imagine that creating AmigaOS apps using a standard C++ class library would be easier than a bunch of C routines with a zillion parameters.

C++ can actually be simpler to learn than C if one sticks to the simpler aspects. C++ can be a higher level language, and thus easier to learn, than C.
For example a C++ string object with overloaded operators makes text manipulation a zillion times easier than in C. Changing properties and running methods to manipulate a control of some kind, is, I am sure, easier to do utilising OOP than lower level C calls.

If someone wrote a standard class library similar to .NET or Java(AWT or SWING) for manipulating windows and various system standard objects etc. (I don't know if one already exists) then newbies would be able to get things up and running quickly in a high level language. It is these sorts of developer shortcuts which have made programming for the Microsoft platform so popular and easy to do.

I would not expect Newbies to build class hierarchies and the like themselves but having them in existence in some sort of toolbox would shortcut development time and lower the threshold for programming in AmigaOS. Everything should be abstracted for the newbies. Remember the whole nature of the new OS rewrite was to keep away from the metal so the rationale for writing in C or assembler and directly hitting the hardware is no longer there.

I think ease of development so that new titles can be written for the platform is far more important that writing a 3d routine that runs milliseconds faster than before. WE NEED NEW SOFTWARE.

If no one does this I would happy to write object wrappers myself which mimic the behaviour of more Rapid Application Development environments like Microsoft's.

I know we all hate Microsoft Winblows, and sometimes MS's over complexity makes you want to pull your hair out but they really have their act together in terms of their development support.

That's my 2 cents.
 

Offline that_punk_guy

  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 4526
    • Show only replies by that_punk_guy
Re: Beginners 'C' programing group
« Reply #31 on: February 13, 2004, 12:29:51 AM »
Maybe the reason so much Windows software is a fat mess is down to programmers who don't understand what the functions they are calling do at a basic level.
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Beginners 'C' programing group
« Reply #32 on: February 13, 2004, 12:30:40 AM »
Nah, it would be best to stick with C, and cover the exact same things as in the ARKRM's & NDK, etc...

Stick to standard stuff.


MUI wouldn't be too bad later on also

 

Offline mikeymike

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 3420
  • Country: 00
    • Show only replies by mikeymike
Re: Beginners 'C' programing group
« Reply #33 on: February 13, 2004, 12:32:36 AM »
I asked some techie friends a while back what they thought would be the best language for me to really get into programming.  They all suggested C.  So here I am :-)

 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Beginners 'C' programing group
« Reply #34 on: February 13, 2004, 12:40:40 AM »
@thread

Sorry, going off topic...

@BigBenAussie

I have been developing a cross platform C++ class library for rapid application (specifically game/multimedia) development.

Presently it is only amigaos implementation level, but it none of the classes expose system level stuff. It handles kernel services, io, gfx, sound, etc. via a set of interfaces and wrappers.

It took 10 mins to write this silly goo clone using these class libraries in their current state.

If c++ is your thing, the source for the above program (but not the class libraries themselves ;-) ) is all here.

(I use a tab of 2 spaces if the source looks screwy)
int p; // A
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Beginners 'C' programing group
« Reply #35 on: February 13, 2004, 12:42:45 AM »
BASIC is a waste of time

C is the best because most of the same code can be used under AmigaOS, MorphOS, and AROS, and you can actually program some decent games and utilities with it.

You don't need objects, streams, classes, templates, vectors etc. for good software for Amiga!


Pluss if you want to learn the standard and normal way to program on Amiga, then Intuition, GadTools, and BOOPSI all use plain C.

 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show only replies by crystall
Re: Beginners 'C' programing group
« Reply #36 on: February 13, 2004, 12:51:33 AM »
Quote
#include
#include

int main(void)
{
printf("hello world\n");
return EXIT_SUCCESS;
}


I think strict ANSI-C code would look like this

#include
#include

int main( void )
{
    printf("Hello world!\n");
    exit(0);
}

and here's something funny about "Hello world!" programs:

Evolution of a programmer
 

Offline BigBenAussie

  • Sr. Member
  • ****
  • Join Date: Feb 2004
  • Posts: 313
    • Show only replies by BigBenAussie
Re: Beginners 'C' programing group
« Reply #37 on: February 13, 2004, 01:17:53 AM »
Not sure if this is going off topic.
I would imagine that a lot of programmer newbies want to play around with 3d, it being such a cool thing.

What do they want to do anyway?

@Karlos
About that 3d C++ library you've written. No offense, but is seems you would also need to incorporate a mighty good tutorial and simple documentation for it to be useful, at least to a newbie.

Has any one thought of talking to, or joining the Cross Platform Open Source Crystal Space 3d group and getting them to do an AmigaOS port.

http://crystal.sourceforge.net/tikiwiki/tiki-index.php?page=About+Crystal+Space

?????
I guess it is off topic as Crystal Space 3d is sure to be too complex for newbies.

Sorry, I've written it now.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Beginners 'C' programing group
« Reply #38 on: February 13, 2004, 01:21:36 AM »
@BigBenAussie

The library actually a set of abstractions comprising a complete framework, not just 3D. Also, it's not for newbies, its for experienced lazy b*stards...

Hence the "off topic" remark ;-)
int p; // A
 

Offline redrumloa

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Re: Beginners 'C' programing group
« Reply #39 on: February 13, 2004, 01:23:16 AM »
I have missed all of this conversation, so forgive me if this has been discussed already.

May I suggest you not take this group private? Do it right here on A-Org, there are already forums for develpment. If it really is going to be a big movement I'm sure you can convince the webmasters of AO to create a new forum. Something like this could be VERY useful to get people onboard, and where else better to have it than here where it can get maximum exposure? Heck if I ever get free time I'D like to learn some programming:-) Freetime is a big IF though :-/
Someone has to state the obvious and that someone is me!
 

Offline that_punk_guy

  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 4526
    • Show only replies by that_punk_guy
Re: Beginners 'C' programing group
« Reply #40 on: February 13, 2004, 01:29:09 AM »
@red

I was thinking the same as the thread unfolded. It could be a very positive thing to have out in the open, readily available...
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Beginners 'C' programing group
« Reply #41 on: February 13, 2004, 01:35:01 AM »
Quote
May I suggest you not take this group private? Do it right here on A-Org,
I agree. I don't see why people want to take this elsewhere...
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Beginners 'C' programing group
« Reply #42 on: February 13, 2004, 01:41:42 AM »
Perhaps to avoid off topic discussion and trolling?

I'm not saying it will definately happen, but you know how it is when people think their solution (and I am as guilty of this as anybody) is better than someone elses and a perfectly simple question gets dragged into a long discussion going way off topic...

...like I am now :lol:
int p; // A
 

Offline that_punk_guy

  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 4526
    • Show only replies by that_punk_guy
Re: Beginners 'C' programing group
« Reply #43 on: February 13, 2004, 01:45:47 AM »
Hmm, yes that's one point against. ;-)

Maybe some cross-polination is in order.

(Wonder what Cyberus will be able to read into that comment?)
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Beginners 'C' programing group
« Reply #44 from previous page: February 13, 2004, 01:47:27 AM »
@crystall
Quote

I think strict ANSI-C code would look like this

#include
#include

int main( void )
{
printf("Hello world!\n");
exit(0);
}

Possibly. However, EXIT_SUCCESS can be used instead of 0, and in general, if there is a define to use, use it instead of fixed value (that way if things would ever change, your code will adapt with just recompile and you don't need to worry about changing all the fixed constants in the code). This is more like generic programming style, not ANSI standard.

I think ansi does state that 0 is "success" for exit(), however. So you're correct here.

Anyway, use of exit() instead of proper failure code path is a bit dull, and forces you to write cleanup stub routines with atexit(), and thus forces you to use global variables. I would advice coders to stay away from exit() if possible, esp if coding for AmigaOS, MorphOS and other compatibles.

The problem is that there is no automatic cleanup for OS resources, just for resources set up by the startup code (stuff provided by the ANSI standard, for example: malloc()d memory, filehandles opened by fopen() etc). So  if you would open a intuition window and call exit() to terminate, the window would not get closed (unless if you do it with atexit cleanup stub routine).

Now I got carried away, sorry. :-)