gcc #define #define #define

gcc #define #define #define

Post by Vlad Peterse » Fri, 05 Sep 1997 04:00:00




> i am serious. i get sick of all those #define #define and
> #define in c!!! i was a happy 95 Delphi user with clean
> codes. fine. i understand #define increases portability and
> u guys would blame borland having nothing but wintel.

> but i just wonder if anyone'd stand out and write a
> comparable products in linux/x like delphi, eliminating
> users' need of writing thousand of #define!

> i don't want flame and understand the importance of #define
> to portability. but i assume you guys are resonable and
> understand #define _absolutely_ decreases readability of
> codes, agree?

Simple. There are several standards designed to alleviate
porting pains. ANSI C, POSIX, X/Open are the major ones.
As long as your program adheres to the above standards it
is easily portable. E.g. for most Xlib and/or Motif programs
it is only required that you need a different makefile
because of various include and lib directories. In fact,
Linux is one of platforms that provide both BSD and SysV
library calls and other features. Try to write or port
something to/from SunOS to IRIX then you will see what all
those #ifdefs are all about. :)

Let me find an example to back up my point: I write a
program and I need to find a way to zero out a memory
area. I found several library functions that can do that,
bzero() and memset(). I look at the bottom of the man
pages:

bzero() CONFORMING TO BSD 4.3

memset() CONFORMING TO SVID 3, BSD 4.3, ISO 9899

Now it is obvious that it is better to use the latter.

Unless, of course, I misunderstood you. What exactly are
you dealing with where you have problems with lots of #ifdefs?
Then maybe me or someone else can provide you some more
specific assistance?

--
<vladimip at uniserve com> | Good pings come in small packets
     Vancouver, BC | SIGSIG: signature too long (core dumped)
Things are more like they are today than they ever were before -
(From a crosspost between alt.suicide and alt.destroy.microsoft)

 
 
 

gcc #define #define #define

Post by Jochen Küppe » Sat, 06 Sep 1997 04:00:00



> =
> i am serious. i get sick of all those #define #define and
> #define in c!!! i was a happy 95 Delphi user with clean

So just write C++ - if you are fine with C, you can just write =

procedural (non-OO) C++, and you get rid of almost all '#defines'.

Ok, conditional compiling is still needed, ...

Jochen

-----------------------------------------------------------------------
  Jochen K=FCpper


  Institut f=FCr Physikalische Chemie I
  Universit=E4tsstrasse 1, Geb 26.43.02.19       phone ++49-211-8113681
  40225 D=FCsseldorf                             fax   ++49-211-8115195
  Germany             http://www-public.rz.uni-duesseldorf.de/~jochen
-----------------------------------------------------------------------

 
 
 

gcc #define #define #define

Post by Larry Blanchar » Mon, 08 Sep 1997 04:00:00



> i don't want flame and understand the importance of #define
> to portability. but i assume you guys are resonable and
> understand #define _absolutely_ decreases readability of
> codes, agree?

_Absolutely_ DISagree (no flame intended either).  Maybe it's
just a personal quirk, but I find DEGREES_TO_RADIANS much more
understandable than 57.29577.
 
 
 

1. m4: how to define var if another defined

        I want to do something like this:

        ifelse(YN,`Y',dnl
        define(NAMED,`yes')dnl
        ,`dnl
        ')dnl

        This doesn't work, of course. How do I
define NAMED _only_ if YN is defined?

--
   _____________________________________________________________________

  | Systems Programmer          University of California, Davis         |
  | Unix Specialist             BCH Technical Services                  |

2. sharing dirs with /dev/loop0, can it be done?

3. #define _POSIX_C_SOURCE and other defines

4. Help: Ensoniq Soundscape

5. gcc not defining _start, ld not linking correctly

6. GCC & XEmacs compilation mode question/help

7. gcc on AIX 4.3, __malloc_postfork... symbol not defined

8. scsi0: PCI error Interrupt at seqaddr = 0xa2

9. Can I define the mantissa and exponent for floating point GCC C compiler?

10. Multiply defined: _NEEDS_SHRLIB_libc_4 (gcc-message)

11. Inline assembler (gcc) and #define

12. math functions not defined in gcc

13. Can I define the mantissa and exponent for floating point GCC C compiler?