You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Kenneth Chiu <ch...@cs.indiana.edu> on 2003/08/15 08:10:59 UTC

Re: cvs commit: xml-axis/c/src/engine SharedObject.h SharedObject.cpp SessionScopeHandlerPool.h SessionScopeHandlerPool.cpp SerializerPool.h SerializerPool.cpp RequestScopeHandlerPool.h RequestScopeHa

On Fri, 15 Aug 2003 susantha@opensource.lk wrote:

> On 14 Aug 2003 12:47:19 -0500, Sam Lang wrote
> > During the compile process for AxisC++, I'm getting a bunch of warnings
> > from the headers:
> >
> > warning: no newline at end of file
> >
> this happens when we develop in both VC++ and Linux. As you know in Windows
> we have CR+LF instead of newline charactor. For the time being running
> dos2unix on all the source will work.
> Anyway we will solve this immediatly.

Technically speaking, this is not really a CR+LF vs. LF
issue.  If you put a CR+LF at the end, g++ will still
compile it happily.  Here's a file with CR+LF that compiles
without warning with g++.  I first dump the file in binary
to show that it has CR+LF for line endings:

    $ od -t cx1 eol.cpp
    0000000   i   n   t       m   a   i   n   (   )       {  \r  \n
	    69 6e 74 20 6d 61 69 6e 28 29 20 7b 0d 0a 20 20
    0000020           r   e   t   u   r   n       0   ;  \r  \n   }  \r  \n
	    20 20 72 65 74 75 72 6e 20 30 3b 0d 0a 7d 0d 0a
    0000040
    $ g++ eol.cpp
    $ g++ --version
    g++ (GCC) 3.2
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here's the same file with LF as line endings, but no final line ending:

    $ od -t cx1 noeol.cpp
    0000000   i   n   t       m   a   i   n   (   )       {  \n
	    69 6e 74 20 6d 61 69 6e 28 29 20 7b 0a 20 20 20
    0000020       r   e   t   u   r   n       0   ;  \n   }
	    20 72 65 74 75 72 6e 20 30 3b 0a 7d
    0000034
    $ g++ noeol.cpp
    noeol.cpp:3:2: warning: no newline at end of file

g++ complains about it.

> > g++ gives this warning, but VC++ doesn't.  Because C++ compilers can
> > differ dramatically across platforms, it might be worthwhile to have
> > a set of C++ coding guidelines, to ensure this kind of problem
> > doesn't happen.  The mozilla project has a set of guidelines for
> > this purpose:
> >
> > http://www.mozilla.org/hacking/portable-cpp.html
>
> We are going through this and we find we have to do small changes to comply
> with this.
>
> >
> > which addresses the above problem:
> >
> > --snip--
> > 10. Put a new line at end-of-file
> >
> > Not having a new-line char at the end of file breaks .h files with
> > the Sun WorkShop compiler and it breaks .cpp files on HP. --snip--
> >
> > I would recommend adopting their guidelines, or coming up with your own.
> >
> > Also, In the following code (HandlerPool.cpp), when WIN32 is not defined
> >
> > (on unix platforms), 'sleep' goes undefined because unistd.h isn't being
> > #included.  So right now this doesn't compile on linux with g++.
> >
> > Instead of using system calls directly here to wait for the handler,
> > it would be nice if there were an AX_wait function that could be overridden
> > by application developers that want to use other threading models.  This
> > would allow them to plugin their own implementations of wait.
>
> Exactly, I will do it today.
>
> >
> > -slang
> >
>
> Thanks,
>
> Susantha.
>
> --
> Lanka Software Foundation (http://www.opensource.lk)
> Promoting Open-Source Development in Sri Lanka
>