Skip to content

Bad preprocessor expansion of sketch results in illegal c++ code. [imported] #297

@cmaglie

Description

@cmaglie

This is Issue 297 moved from a Google Code project.
Added by 2010-07-22T00:52:26.000Z by GorillaCoder.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium

Original description

Try to compile the below sketch:

    class SleepCycle  {
    public:

        SleepCycle( const char* name );
        int foo;
    }; // class SleepCycle

    SleepCycle::SleepCycle( const char* name )
    :   foo    ( 0 )
    {
    }

The c++ compilation fails because the generated c++ is bad:

    include "WProgram.h"
    foo    ( 0 ); 
    class SleepCycle  {
    public:

        SleepCycle( const char* name );
        int foo;
    }; // class SleepCycle

    SleepCycle::SleepCycle( const char* name )
    :   foo    ( 0 )
    {   
    }   

It can be fixed by removing the spaces between the name and paren in the initializer for foo.
: foo( 0 )

Metadata

Metadata

Assignees

Labels

Component: PreprocessorThe Arduino sketch preprocessor converts .ino files into C++ code before compilation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy