Welcome, Guest. Please login or register.

Author Topic: Still C compiler selection hints...  (Read 2854 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ognixTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2004
  • Posts: 256
    • Show only replies by ognix
Still C compiler selection hints...
« on: February 26, 2010, 11:18:06 AM »
Hello!
I read some past threads on choosing the right compiler for the right job, but I have a few more questions/unclear things on this argument.

I understood there some free C compilers:
- gcc (hard to setup and not so user friendly)
- vbcc (very Amiga like, easy to setup and light)
- AmiDev (cross-platform compiler)
- DICE C (light, Amiga-based, easy, once upon a time commercial product)

...and the old commercial product
- SAS/C
...and the more "recent"
- Storm C

My main aim is to do some basic stuff (at the beginning) focussing mostly on the classic platform (OS3.X), but with the idea of porting the most valuable project also on the other Amiga flavours.

In the past times I bought DICE C, and I started a few small project and experiments, and I found it easy and well done.
Later on I found a good offer for the famous SAS/C package and I bought it, but I never realized to use it properly.

But now I don't want to start to code eg. with SAS/C if it contains too many non-stardard compiler dependencies (as I read in a forum), since this will lead to difficulties in porting the code on other platforms/flavours.

But I'd like to know if the big manuals are still valuable for programming the Amiga today, or if the info is outdated, and the docs can be found on the Internet are more the sufficient for a proper and clean coding.

Ahhh... I don't need C++ (at least on my Amiga projects), and is it true that I can make a shared library just with SAS/C and Storm C? This seems strange to me...

Thanks for any info!
« Last Edit: February 26, 2010, 11:33:31 AM by ognix »
 

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: Still C compiler selection hints...
« Reply #1 on: February 26, 2010, 12:13:36 PM »
Quote from: ognix;545211
- AmiDev (cross-platform compiler)
- Storm C
Those are gcc as well.

Quote
is it true that I can make a shared library just with SAS/C and Storm C?
You can create a shared library with any of those compilers.
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: Still C compiler selection hints...
« Reply #2 on: February 26, 2010, 01:37:17 PM »
The best C compiler is SASC.  Use the best.  Forget the rest.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline Joloo

Re: Still C compiler selection hints...
« Reply #3 on: February 28, 2010, 10:58:11 AM »
Quote from: ChaosLord;545228
The best C compiler is SASC.  Use the best.  Forget the rest.


Define 'best' compiler!?!

Is it that one, which allows to compile source codes in no time, or is it that one, which creates executables as optimised as code written in assembler, or, which creates executables of similar size like code written in assembler, or is the best C-compiler that one, which runs even fine with a stack size of only 4096 bytes while compiling, or is that one, which conforms to strict ANSI C & C++, or that one, which allows all the features, that makes gcc so incompatible, or is it that one, which does not need lots of RAM while compiling, or is it that one which supports different targets (operating systems and CPUs), or is it that one, which is well integrated into the host OS, or is it that one, which has got everything ever needed in its C-runtime library, or is it that one, which can cross-compile?

As you can see, I have a clear opinion of what I would call a 'best' compiler.
And SAS/C is farer away of that than I of the moon, IMHO. :)
Besides, there isn't a best compiler for me but just a compiler that fits better my needs than others.
SAS/C suits your needs, mine it does not.
 

Offline Joloo

Re: Still C compiler selection hints...
« Reply #4 on: February 28, 2010, 11:10:42 AM »
Quote from: ognix;545211
- gcc (hard to setup and not so user friendly)


It is not hard to setup for OS3, but it takes time, especially for searching and downloading all the relevant parts.
One to three hours must be invested, depending on your experience.
vbcc comes with an Amiga installation script, hence it is much easier to install and requires only a few seconds or minutes to be installed, depending on the host machine and backends you want to have installed.


Quote
My main aim is to do some basic stuff (at the beginning) focussing mostly on the classic platform (OS3.X), but with the idea of porting the most valuable project also on the other Amiga flavours.


That can be reached with any compiler as long as you ignore special features of the compiler's C-runtime lib and special compiler features. This doesn't mean that you can use DICE C or SAS/C for porting, but that you can use gcc or vbcc for this task with no or only few changes applied to the source code.


Quote
But now I don't want to start to code eg. with SAS/C if it contains too many non-stardard compiler dependencies (as I read in a forum), since this will lead to difficulties in porting the code on other platforms/flavours.


What makes SAS/C so special is its C-runtime lib. If you forego to use functions, which are SAS/C only, like for example stcd_l and the alike, and use instead the OS provided counterparts, nothing speaks against using SAS/C, even you take into consideration to port this source code one time to another Amiga flavour.


Quote
But I'd like to know if the big manuals are still valuable for programming the Amiga today, or if the info is outdated, and the docs can be found on the Internet are more the sufficient for a proper and clean coding.


I would speculate that your manuals cover the operating system of version 2, not 3. That means they are outdated in some segments, but not entirely.
Always have the current autodocs at hand in order to verify what in the manuals is stated. Non standard C-lib functions of the SAS/C C-runtime library should be avoided by all means, otherwise you put yourself into the trouble to re-design them for other Amiga flavours or compilers, once you want to port your source codes.


Quote
Ahhh... I don't need C++ (at least on my Amiga projects), and is it true that I can make a shared library just with SAS/C and Storm C? This seems strange to me...


As Piru already pointed out, it can be done with any compiler, even with HiSoftC++, which is a weak compiler.
To hide compiler specific attributes and keywords, use SDI_Headers, which is a collection of macros just designed for this purpose.

If you want to write a shared library, have a look at "Weaver" on "amimedic.de", which is a tool that allows you to create the library frame on a source code level. It makes use of SDI_Headers and supports you in creating OS3, AROS, MorphOS and AmigaOS4 shared library source codes. The created results were already successfully tested with gcc and vbcc.
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: Still C compiler selection hints...
« Reply #5 on: February 28, 2010, 11:17:50 AM »
Quote from: Joloo;545487
Define 'best' compiler!?!

Is it that one, which allows to compile source codes in no time, or is it that one, which creates executables as optimised as code written in assembler, or, which creates executables of similar size like code written in assembler, or is the best C-compiler that one, which runs even fine with a stack size of only 4096 bytes while compiling, or is that one, which conforms to strict ANSI C & C++, or that one, which allows all the features, that makes gcc so incompatible, or is it that one, which does not need lots of RAM while compiling, or is it that one which supports different targets (operating systems and CPUs), or is it that one, which is well integrated into the host OS, or is it that one, which has got everything ever needed in its C-runtime library, or is it that one, which can cross-compile?


SAS/C lacks C++ and it is available only for Amiga (so no cross-compiling possible) but pretty much everything else is in SAS/C.

Quote

Non standard C-lib functions of the SAS/C C-runtime library should be avoided by all means, otherwise you put yourself into the trouble to re-design them for other Amiga flavours or compilers, once you want to port your source codes.


Libnix covers many SAS/C C lib extensions for 68k and MorphOS...
My Amigas: A500, Mac Mini and PowerBook
 

Offline Joloo

Re: Still C compiler selection hints...
« Reply #6 on: February 28, 2010, 01:54:19 PM »
Quote from: itix;545492
SAS/C lacks C++ and it is available only for Amiga (so no cross-compiling possible) but pretty much everything else is in SAS/C.


I personally wouldn't vote for any compiler, hence I made no suggestion. Everybody should test different compilers and use the one that suits best.
SAS/C was the de-facto compiler a long time ago for AmigaOS but since the entire community is splitted into several camps (in case they didn't quit) with different processors and APIs, SAS/C is only suitable for m68k code generation. As I pointed out it doesn't matter as long as one is targetting his programs only towards this platform and the standard Amiga API, but it gets complicated when someone thinks that he can port source codes, that rely on SAS/C special features and its C-runtime lib, with no efforts to other platforms.

I used several compilers on the Amiga in the past till I found the one, which came close to my vision of a C compiler.
Today the most important aspect for me is to have installed a compiler that comes with different backends in order to support all camps, if necessary.


Quote
Libnix covers many SAS/C C lib extensions for 68k and MorphOS...


Correct me if I am wrong. I think you're referring to updated Libnix packages and hand-tuned specs-files for gcc and those are hardly to be found. MorphOS has got these in contrast to the standard (classic) AmigaOS installation.
If one who is not really familiar with gcc and the related stuff tries to update it himself, a nervous breakdown isn't very far. :)
 

Offline asymetrix

  • Full Member
  • ***
  • Join Date: May 2007
  • Posts: 118
    • Show only replies by asymetrix
Re: Still C compiler selection hints...
« Reply #7 on: February 28, 2010, 02:56:30 PM »
Amiga C compilers are still in the stone age unfortunately.

What we need is one C/C++/asm compiler suite for all Amiga camps.

Select which Amiga API one wants to develop for (or compatible API) and the IDE should highlight incompatible API and offer to rewrite source code.

Help system linked to an online API comparison site, showing more details and example usage for different Amiga flavours.

Maybe offending APIs could be wrapped into a compatible function / class.

The same would be required for GFX/sound RTG APIs.
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show only replies by unusedunused
Re: Still C compiler selection hints...
« Reply #8 on: February 28, 2010, 03:46:57 PM »
The advantages of sasc or stormc3 is a good graphical source level debugger and they compile lots faster.but its no GCC and if you want compile portable Unix programs with that then thats hard

stormc4 is based on GCC but i dont know if here the storm graphical debugger work well for 68k.
« Last Edit: February 28, 2010, 03:51:59 PM by bernd_afa »
 

Offline x303

Re: Still C compiler selection hints...
« Reply #9 on: February 28, 2010, 06:17:45 PM »
Quote from: bernd_afa;545521
stormc4 is based on GCC but i dont know if here the storm graphical debugger work well for 68k.
The debugger works for 68k, but not for WOS.

x303 :D :D :D
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show only replies by SamuraiCrow
Re: Still C compiler selection hints...
« Reply #10 on: February 28, 2010, 07:14:46 PM »
The StormC 4 debugger works to a certain extent but doesn't work for global variables, or so I've heard.  The SAS/C debugger kicks all 68k versions of GDB all over the place.
 

Offline ognixTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2004
  • Posts: 256
    • Show only replies by ognix
Re: Still C compiler selection hints...
« Reply #11 on: March 01, 2010, 02:22:18 PM »
Hello!  :)
Thanks a lot to all those answered, but especially to Joloo for being so precise and detailed.
Now I've a clearer idea on what to do.

...and yes, the SAS/C manuals cover Amiga OS up to version 2.0 not 3.0 (even if it seems there are some references to OS 3 - my version is one of the lastest released to the market), and I read about the special SAC/C functions, well indicated in the second manual in the field "Portability" (good quality SAS stuff).
Thanks once more!