Results 1 to 5 of 5

Thread: slice2cpp generate bad string literals

  1. #1
    jbrouault is offline Registered User
    Name: Jean Baptiste Rouault
    Organization: diateam
    Project: none at the moment...
    Join Date
    Oct 2010
    Posts
    3

    slice2cpp generate bad string literals

    I'm using Ice 3.4.1 on linux build with gcc 4.4.3 and linked against the ZeroC patched version of mcpp.

    slice2cpp generates bad code for the following slice :
    module Foo
    {
    const string bar = "foo\"quoted\"bar";
    };
    The generated code is below, the double quotes inside the string aren't escaped anymore:
    const ::std::string bar = "foo"quoted"bar";
    If in the slice I use bar = "foo\\\"quoted\\\"bar" then slice2cpp generates valid c++ code.

    I guess that the function writeConstantValue() in slice2cpp/Gen.cpp should do something similar to Slice::JavaVisitor::writeConstantValue() in the java generator.

    Regards,
    Jean-Baptiste

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    Thanks for reporting this.

    Regards,
    Mark

  3. #3
    chow is offline Registered User
    Name: Brian Chojnowski
    Organization: ATT
    Project: ACD event publisher 3rd party call control server
    Join Date
    Aug 2007
    Posts
    17

    Problem with c++ (vs2010 ultimate) compiling generated floating point literal

    slice file snippet:

    ["clrroperty", "clr:class", "cpp:class"] struct RaceXPAdjState {
    RACECLSSKEY key;
    float xpAdj = 1.0;
    };

    produces:


    Ixxon::RaceXPAdjState::RaceXPAdjState() :
    xpAdj(1F)
    {
    }

    which when compiling give the following errors:

    1>Ixxon.cpp(3382): error C2059: syntax error : 'bad suffix on number'
    1>Ixxon.cpp(3382): error C2146: syntax error : missing ')' before identifier 'F'
    1>Ixxon.cpp(3382): error C2612: trailing 'identifier' illegal in base/member initializer list
    1>Ixxon.cpp(3382): error C2059: syntax error : ')'
    1>Ixxon.cpp(3383): error C2065: 'F' : undeclared identifier

    Manually changing (1F) to (1.0F) fixes the problem.

  4. #4
    chow is offline Registered User
    Name: Brian Chojnowski
    Organization: ATT
    Project: ACD event publisher 3rd party call control server
    Join Date
    Aug 2007
    Posts
    17
    Forgot to mention, this is with Ice 3.4.2. I never had a problem with 3.4.1 so I am not sure what it used to generate.

  5. #5
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Brian,

    Unfortunately it's a bug that was introduced in 3.4.2. See default vaules in Slice for a work-around.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. slice2cpp produces bad code
    By Sheff in forum Bug Reports
    Replies: 8
    Last Post: 01-27-2009, 04:59 PM
  2. Bad Allocation on stringToProxy?
    By litghost in forum Help Center
    Replies: 5
    Last Post: 03-04-2007, 01:43 PM
  3. problem in mapping string->string[] in C#
    By teayu in forum Help Center
    Replies: 2
    Last Post: 10-26-2004, 11:12 PM
  4. slice2cpp syntax error using string simple types
    By MKoleoso in forum Help Center
    Replies: 2
    Last Post: 09-28-2004, 01:12 PM
  5. Replies: 3
    Last Post: 08-12-2004, 08:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •