Visual Studio warning C4819

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Visual Studio warning C4819

Eric Ehlers-2
Hi All,

Would anyone object to a policy of using only ASCII characters in source
code files?  At present, non-ASCII characters (>128, aka extended ASCII)
appear in various comments and literal strings in the source code, for
example line 54 of file ql/currency.hpp:

        //! fraction symbol, e.g, "¢"

If the machine on which you're reading this message uses the same mapping
as mine for non-ASCII characters, then that line ends with a cent symbol
in double quotes.

On other machines, that character (162) is interpreted as some other
symbol, or is not recognized at all and is rendered as a question mark.
When the code is compiled on such a machine, Visual Studio emits the
following:

    warning C4819: The file contains a character that cannot be
    represented in the current code page. Save the file in Unicode
    format to prevent data loss.

Some possible courses of action:
1) Restrict ourselves to the ASCII character set
2) Convert all source code files to Unicode format
3) Disable C4819
4) Do nothing and as today leave affected parties to work around the
problem by implementing one of the above as a local hack

Any thoughts?

Thanks,
Eric



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio warning C4819

rmeenaks
RE: [Quantlib-dev] Visual Studio warning C4819

Unicode, more standard and allows us to use more extended characters...


Ram


-----Original Message-----
From: [hidden email] on behalf of Eric Ehlers
Sent: Sun 2/24/2008 6:38 PM
To: [hidden email]
Subject: [Quantlib-dev] Visual Studio warning C4819

Hi All,

Would anyone object to a policy of using only ASCII characters in source
code files?  At present, non-ASCII characters (>128, aka extended ASCII)
appear in various comments and literal strings in the source code, for
example line 54 of file ql/currency.hpp:

        //! fraction symbol, e.g, "¢"

If the machine on which you're reading this message uses the same mapping
as mine for non-ASCII characters, then that line ends with a cent symbol
in double quotes.

On other machines, that character (162) is interpreted as some other
symbol, or is not recognized at all and is rendered as a question mark.
When the code is compiled on such a machine, Visual Studio emits the
following:

    warning C4819: The file contains a character that cannot be
    represented in the current code page. Save the file in Unicode
    format to prevent data loss.

Some possible courses of action:
1) Restrict ourselves to the ASCII character set
2) Convert all source code files to Unicode format
3) Disable C4819
4) Do nothing and as today leave affected parties to work around the
problem by implementing one of the above as a local hack

Any thoughts?

Thanks,
Eric



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio warning C4819

Luigi Ballabio
In reply to this post by Eric Ehlers-2
On Sun, 2008-02-24 at 23:38 +0000, Eric Ehlers wrote:
> At present, non-ASCII characters (>128, aka extended ASCII)
> appear in various comments and literal strings in the source code
>
> Some possible courses of action:
> 1) Restrict ourselves to the ASCII character set
> 2) Convert all source code files to Unicode format
> 3) Disable C4819
> 4) Do nothing and as today leave affected parties to work around the
> problem by implementing one of the above as a local hack

Hmm. (3) seems strangely appealing...

Luigi


--

There is no such thing as public opinion. There is only published
opinion.
-- Winston Churchill



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio warning C4819

Eric Ehlers-2
On Mon, February 25, 2008 4:53 pm, Luigi Ballabio wrote:

> On Sun, 2008-02-24 at 23:38 +0000, Eric Ehlers wrote:
>> At present, non-ASCII characters (>128, aka extended ASCII)
>> appear in various comments and literal strings in the source code
>>
>> Some possible courses of action:
>> 1) Restrict ourselves to the ASCII character set
>> 2) Convert all source code files to Unicode format
>> 3) Disable C4819
>> 4) Do nothing and as today leave affected parties to work around the
>> problem by implementing one of the above as a local hack
>
> Hmm. (3) seems strangely appealing...

Done.

Regards,
Eric


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio warning C4819

Eric Ehlers-2
In reply to this post by Luigi Ballabio
Hi All,

On Mon, February 25, 2008 4:53 pm, Luigi Ballabio wrote:

> On Sun, 2008-02-24 at 23:38 +0000, Eric Ehlers wrote:
>> At present, non-ASCII characters (>128, aka extended ASCII)
>> appear in various comments and literal strings in the source code
>>
>> Some possible courses of action:
>> 1) Restrict ourselves to the ASCII character set
>> 2) Convert all source code files to Unicode format
>> 3) Disable C4819
>> 4) Do nothing and as today leave affected parties to work around the
>> problem by implementing one of the above as a local hack
>
> Hmm. (3) seems strangely appealing...
>
> Luigi

It turns out, (3) doesn't work, at least not with "pragma warning
disable".  When you load a cpp file containing a non-ASCII character, the
compiler hits the problem character before it sees the pragma directive,
so C4819 still appears everywhere.

The only way to disable the warning is to add /wd4819 to the compiler
settings - any objection if I make that change?

Regards,
Eric



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio warning C4819

Ferdinando M. Ametrano-3
On Tue, Mar 4, 2008 at 1:57 PM, Eric Ehlers <[hidden email]> wrote:

>  >> At present, non-ASCII characters (>128, aka extended ASCII)
>  >> appear in various comments and literal strings in the source code
>  >>
>  >> Some possible courses of action:
>  >> 1) Restrict ourselves to the ASCII character set
>  >> 2) Convert all source code files to Unicode format
>  >> 3) Disable C4819
>  >> 4) Do nothing and as today leave affected parties to work around the
>  >> problem by implementing one of the above as a local hack
>  >
>  > Hmm. (3) seems strangely appealing...
>  >
>  > Luigi
>
>  It turns out, (3) doesn't work


what is so hard about 2 ?

ciao -- Nando

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio warning C4819

Eric Ehlers-2
Hi All,

On Tue, March 4, 2008 4:10 pm, Ferdinando Ametrano wrote:

> On Tue, Mar 4, 2008 at 1:57 PM, Eric Ehlers <[hidden email]>
> wrote:
>>  >> At present, non-ASCII characters (>128, aka extended ASCII)
>>  >> appear in various comments and literal strings in the source code
>>  >>
>>  >> Some possible courses of action:
>>  >> 1) Restrict ourselves to the ASCII character set
>>  >> 2) Convert all source code files to Unicode format
>>  >> 3) Disable C4819
>>  >> 4) Do nothing and as today leave affected parties to work around the
>>  >> problem by implementing one of the above as a local hack
>>  >
>>  > Hmm. (3) seems strangely appealing...
>>  >
>>  > Luigi
>>
>>  It turns out, (3) doesn't work, at least not with "pragma warning
>>  disable".  When you load a cpp file containing a non-ASCII character, the
>>  compiler hits the problem character before it sees the pragma directive,
>>  so C4819 still appears everywhere.
>>
>>  The only way to disable the warning is to add /wd4819 to the compiler
>>  settings - any objection if I make that change?
>
> what is so hard about 2 ?
>
> ciao -- Nando

I don't know that (2) is hard and it's probably the correct full long term
solution, provided that it doesn't cause problems elsewhere in our
development environment - e.g. platforms other than Visual Studio on
Windows, subversion - which I suspect it doesn't.

For now, (3) is an immediate fix which I would argue is preferable to the
current state of affairs, so I went ahead and implemented that, if this
causes anyone any problems please let me know.

Regards,
Eric



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev