Welcome, Guest. Please login or register.

Author Topic: 2 ISO C 16.3.3/3 or previous, informations needed  (Read 1940 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
2 ISO C 16.3.3/3 or previous, informations needed
« on: May 04, 2007, 04:36:52 PM »
Hi. Seems that even the ISO C standards are commercial, most google searches give me links to places selling it :-x
I got the essential part of the macros I'm doing working:) But  I really need to know 2 things wich are essential to make them compatible with most compilers as some behave differently and have diferent limits.
1- What's the maximum macro argument nesting limit for preprocessor macro calls(i.e. MACROA(MACROB(MACROC(args))) )?
2- What's the maximum line lenght ?

I remember reading that the official limit for nested structs was 8 on iso 89 I think, so there must also be some official limit for the preprocessor.

Cheers
José
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline meega

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 952
    • Show only replies by meega
Re: 2 ISO C 16.3.3/3 or previous, informations needed
« Reply #1 on: May 04, 2007, 04:58:37 PM »
If you'll bear with me, I have just picked up Kernighan & Ritchie "The C Programming Language, 2nd edition, ANSI C" from my shelf, and will have a look to see if there is anything in there.

Edit: I'm not really sure that there are any limits imposed by the language, though there might be in the implementation of the compiler that you use, and of course, the machine itself.

Edit2: Appendix A12 (p228-233) Preprocessing: says nothing about limits.

Edit3: Chapter 4.11 (p88-92) The C Preprocessor: says nothing about limits.
:)
 

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: 2 ISO C 16.3.3/3 or previous, informations needed
« Reply #2 on: May 04, 2007, 05:28:58 PM »
From what I've see so far, documentation about the preprocessor is completely scarce in C books.
The ISO specs are much more specific, I've seen a few posts on GCC mailing lists about allowed tokens in concatenations, for example, all referencing ISO docs.
SASC seems to be very limitative on this. A nest of 32 macros like the above makes it report an internal error. VBCC and Borland(X86 8-) ) seem to be less limitative, though I haven't tested them to extremes.

Basically I need a limit to settle down to.
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline meega

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 952
    • Show only replies by meega
Re: 2 ISO C 16.3.3/3 or previous, informations needed
« Reply #3 on: May 04, 2007, 05:43:51 PM »
I honestly think that the limits you might encounter are entirely due to the compiler implementation. They are not a part of the definition of the language, which is why such things do not appear in the Reference Manual (Appendix A, nothing about limits in Sections A1-A13, p191-239, just checked it all).
:)
 

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: 2 ISO C 16.3.3/3 or previous, informations needed
« Reply #4 on: May 05, 2007, 04:55:50 PM »
"...just checked it all"

Thanks for your time.
Gonna try to make a selfexpanding thing in layers :lol:
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline meega

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 952
    • Show only replies by meega
Re: 2 ISO C 16.3.3/3 or previous, informations needed
« Reply #5 on: May 05, 2007, 05:34:54 PM »
 :crazy:

Edit: Borland C++ Builder: The Complete Reference (Osborne/McGraw-Hill, 2001) Chapter 9: "The Preprocessor and Comments" (p235-256) also says nothing about any limits.
:)
 

Offline darkcoder

  • Full Member
  • ***
  • Join Date: Sep 2002
  • Posts: 164
    • Show only replies by darkcoder
Re: 2 ISO C 16.3.3/3 or previous, informations needed
« Reply #6 on: May 10, 2007, 09:16:07 AM »
Hi!

 have you checked this document? http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

(there are also other interesting docs on that site)

I am not sure whether its the standard or just a working on draft.
I gave a quick look and couldn't find limits on marcos nesting.

My 2 cents
The Dark Coder / Trinity