httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <>
Subject Re: [multi-env] illegal escape sequence
Date Wed, 16 Feb 2005 12:56:50 GMT
Randy Kobes <> writes:

> On Win32, in the multi-env branch (but also in trunk), I get
> an error when compiling library/t/cookie.c:
> D:\svn\MULTI-~1\library\t\cookie.c(114) :
>     error C2017: illegal escape sequence
> This arises whenever an escaped quote is used, as in
>    "rfc=out; Version=1; domain=\"\""
> of line 114 in cookie.c, apparently due to VC++ not being
> able to correctly use AT_str_eq() of at.h in this case. I've
> found qualitatively similar problems with google, but can't
> find something that works here - does this ring a bell with
> anyone? Thanks.

Boggle: what happens when you feed that string to this macro:

  #define QUOTE_ME(foo) #foo
  const char bar[] = QUOTE_ME("rfc=out; Version=1; domain=\"\"");

K&R says this about #foo:

  First, if an occurrence of a parameter in the replacement token
  sequence is immediately preceded by ##, string quotes (") are placed
  around the corresponding parameter, and then both the # and the 
  parameter identifier are replaced by the quoted argument.  A \ character
  is inserted before each " or \ character that appears surrounding,
  or inside, a string literal of character constant in the argument.

I take this to mean that the above expands to

  const char bar[] = "\"rfc=out; Version=1; domain=\\\"\\\"\"";

Does VC++ think this is an illegal escape sequence as well?
It'd be nice to know exactly what the preprocessor finds 
objectionable here; maybe the at.h just needs the usual 

#ifdef  __cplusplus
 extern "C" {

wrapper (C++ may have tighter macro expansion rules)?

Joe Schaefer

View raw message