Re: Should compiler generate an error at the time of compiler?

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

 



On Wed, 2004-09-22 at 22:00, Sergey M. Samoylov wrote:
> I have a code with mistake:
> 
> extern int errno;
> main()
> {
> 	printf("errno=%d",errno);
> }
> Why in any cross gcc compilers when it compiler, compiler will pass?
> Why compiler will not say me about any mistakes like:
> : undefined reference to 'errno'
> 
> It's just only in cross compiler in usuall compiler gcc-3.3.1 it's OK and 
> compiler generate the error.

There is no actual error here.  you are defining an external variable
that is errno that may or may not exist at link time.  I have a bit of
legacy code and the link step fails not the compile step.

If the cross compiler defines errno as a true external int (which is
permissible under the standard) but of course it is not portable.

-- 
Thanks
KenF
OpenOffice.org developer


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux