[Haifux] Haifux Digest, Vol 17, Issue 15

Shachar Shemesh shachar at shemesh.biz
Tue Jan 27 15:51:46 MSK 2009


Tzafrir Cohen wrote:
>
> Most files can be either dos or unix, but some (notably shell scripts)
> must be unix.
>   
C source and header files too. For most lines, a new line or a carriage 
return followed by a line feed are the same in C, so it is not trivial 
to spot the difference. It does show up when you start using line 
continuation macros:

#define A "a line"\
    "followed by another line"

If this file is under a Unix encoding, it will work fine on both 
platforms. If it's under a Windows encoding, under Unix the compiler 
will assume that the back slash escapes the carriage return, which 
leaves the new line unescaped, and the file will not compile (at least 
on some compilers).

>
> BTW: another crazy way to convert source files between dos and unix
> formats is to store them in an SVN repository and check them out
> separately in each environment.
>   
That only works if you set the svn:eol-style svn property to "native". 
This does not happen automatically.

svn propset svn:eol-style native {list of C source and header files, or 
whatever}

Be sure not to set this property on the Visual Studio solution files, as 
it may well corrupt them.

Shachar



More information about the Haifux mailing list