Re: Orphaning GCL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jerry James wrote:
On Wed, Nov 5, 2008 at 6:32 AM, Richard W.M. Jones <rjones@xxxxxxxxxx> wrote:
On Mon, Nov 03, 2008 at 08:45:29PM -0700, Jerry James wrote:
int main() {
#include <unistd.h>
  return 0;
}
Is it supposed to be possible to compile this?

No, that's not legal C.  I didn't know that, so I learned something
from the experience, which makes it a good one.  I sent a patch
upstream yesterday to fix the GCL code so it doesn't do this.

OT but.. That snippet *is* legal C, but the validity of compiling this file then depends on the content of unistd.h (which if it's a "real" unistd.h will of course never produce legal preprocessed C...).

If the file being included were to just contain e.g. statements, macro or variable declarations and definitions the above code would compile just fine.

You can put a preprocessor directive pretty much anywhere you like, as long as it's the first non-whitespace thing on the line (I think), you're just expected to make sure the results of processing that directive result in legal preprocessed sources.

Regards,
Bryn.

---x.c---
#include <stdio.h>
int main(int argc, char **argv)
{
#include "y.h"
        return 0;
}

---y.h---
int a = 2, b = 2;
printf("%d + %d = %d\n", a, b, a+b);

--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux