Skip to content

Stop changing my code [imported] #1112

Closed
@cmaglie

Description

@cmaglie

This is Issue 1112 moved from a Google Code project.
Added by 2012-11-14T09:18:07.000Z by o...@wanadoo.es.
Please review that bug for more context and additional comments, but update this bug.
Closed (WontFix).

Original labels: Type-Defect, Priority-Medium

Original description

The Arduino development environment makes a series of modifications to the code provided by the user, presumably as a user-friendly gesture towards those who can't code proper C++.

The problem is that people who actually know C++ and write sketches (?) on accordance are having a lot of pain with those "user-friendly" source code transformations. Basically, the Arduino IDE turns perfectly valid C++ programs into incorrect ones.

A glaring example is the automatic generation of function prototypes, which are fundamentally broken. Even the recent patch mentioned in

http://code.google.com/p/arduino/issues/detail?id=973

falls short on the presence of functions with default arguments, and I suspect that it fails too when the function signature spans over several lines.

C++ syntax is really complex and automatic generation of prototypes won't work unless you implement a good chunk of a C++ parser, which is unlikely to happen if reasonable at all.

So I suggest allowing some sort of flag in the source code of those sketches for indicating "I'm a C++ programmer. Honest!" and stopping the Arduino IDE from messing with the code. Switching off prototype generation to begin with, although not prepending the code with the standard Arduino headers would be good too for avoiding problems with line numbers of compiler reports, see

http://code.google.com/p/arduino/issues/detail?id=455

I realize that not adding those headers could pose maintenance problems for the user when the Arduino developers decide to use a difference preamble, but we are talking about real C++ developers and they can quickly figure out what the problem is on that case.

Something like

pragma arduino-literal-C++-code

should be fine. The IDE would inspect the sketch for the presence of that text and switch off the related features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: WontfixArduino has decided that it will not resolve the reported issue or implement the requested feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions