-
-
Notifications
You must be signed in to change notification settings - Fork 114
Multiline templates not supported in sketch #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @PaulStoffregen on November 2, 2015 20:1 Everyone should test with the latest hourly build before reporting any issue! |
From @xEtherealx on November 2, 2015 21:24 Ah thanks, that works! But the following does not:
|
From @matthijskooijman on November 2, 2015 22:0 Hm, that's weird. The preprocessed source file looks like this:
It seems the prototype is generated correctly, but the
@ffissore, I guess ctags doesn't completely understand templates after all, then? |
From @matthijskooijman on November 2, 2015 22:4 ctags output looks like this:
and for the working version with the template on a single line:
The gist of the ctags output looks identical, so I guess that for template functions, the prototype is built from the code line, instead of the function signature like normally? @ffissore, if this is so, perhaps we should drop that and just not generate prototypes for template functions? |
From @Chris--A on November 2, 2015 22:29 I'm not sure its a valid solution having simple functions generated, and basically everything else not. Maybe its time to stop hiding the basics of C++ and not generate any prototypes at all. It'll break old code, however the new arduino-builder has already broken previously working prototypes. I have a good list here: #30 I do not think it's going to be much of a problem, as the forum is already & still going to be bombarded with questions asking why some functions do not work. |
From @PaulStoffregen on November 2, 2015 22:33
No. Massively breaking compatibility is not an option! |
From @Chris--A on November 2, 2015 23:28 Well as it stands, that is what is happening. This really needs to be sorted out, I just do not think disabling prototype generation for a majority of function signatures is an option either. If were going to tell people to generate their own for templates, bound return types, functions with optional parameters, (list goes on)... then we might as well disable it all (KISS, we don't need two rules for the same thing)! I know... just pointing out the obvious. 😄 |
@matthijskooijman as you found out, ctags output includes one code line, not "function". I will not disable template generation as it works well when functions are written all on one line. If "one line" is not an option, writing the prototype yourself is the workaround. This was one of the main goal of arduino-builder: do whatever you can to make things just work and provide options when they don't work. Previous prototype generation failed miserably, leaving users the only option to stop using the IDE: templates are an example, see #472 As for #30, some work is already available (see "functionpointer" branch): I just don't yet feel confident enough with it. |
Hmm, I'll have to get my 'go' shoes on I think. I'm sure I;ll be able to pick it up quickly. |
Or you just wait a couple of hours, or later tomorrow, and I'll merge that branch on master a provide its features through hourly IDE builds. We are busy packing atm |
No worries, I pull the changes and rebuild... Then try and verify/break it :) |
Branch |
From @xEtherealx on November 2, 2015 19:56
The following sketch fails to compile:
With
error: 'T' does not name a type
This is with 1.6.5 on a mac
Copied from original issue: arduino/Arduino#4067
The text was updated successfully, but these errors were encountered: