Error Return-statement With No Value In Function Returning
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site error return-statement with no value in function returning ‘int’ -fpermissive About Us Learn more about Stack Overflow the company Business Learn more about error return-statement with no value in function returning 'int' -fpermissive hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss no return statement in function returning non-void Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up error: return-statement with no return statement in function returning non-void c++ no value, in function returning ‘void*’ [-fpermissive] [closed] up vote -5 down vote favorite When trying to "make" a file I keep getting the following error: error: return-statement with no value, in function returning ‘void*’ [-fpermissive] I can show the code to people who would like to see, but I would rather send it over a message. I've searched some and some people suggest it's
Warning No Return Statement In Function Returning Non Void
a compiling error that is common in "newer" compilers... and yes, I updated mine yesterday. Horrid idea. c++ compilation share|improve this question asked Aug 2 '13 at 19:07 user2529727 615 closed as off-topic by H2CO3, Brian Neal, Richard Sitze, chris, Antti Haapala Aug 2 '13 at 19:33 This question appears to be off-topic. The users who voted to close gave this specific reason:"Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance." – Community, Richard Sitze, chris, Antti HaapalaIf this question can be reworded to fit the rules in the help center, please edit the question. 4 You expect people to help you without you posting code? –Rapptz Aug 2 '13 at 19:07 I suggest that you return a value on the line that has a return statement with no value. I suspect this will fix the error. –Casey Aug 2 '13 at 19:09 1 Chances are the function expects you to return a king or a Jedi but you aren't returning either. –Captain Obvlious Aug 2 '13 at
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn
Return With A Value In Function Returning Void Enabled By Default
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags no return statement in function returning non-void [-wreturn-type] Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, no return in function returning non-void eclipse helping each other. Join them; it only takes a minute: Sign up Recursive factorial error return-statement with a value, in function returning 'void' [-fpermissive] up vote 0 down vote favorite I try to write a factorial using http://stackoverflow.com/questions/18024406/error-return-statement-with-no-value-in-function-returning-void-fpermissi recursive function. What is wrong with this code? I get error return-statement with a value, in function returning 'void' [-fpermissive] #include
| Forgot Password Login: [x] User account creation filtered due to spam. Bug43943 - "warning: no return statement in function returning non-void" should be an error Summary: "warning: no return statement in function returning non-void" should be https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43943 an error Status: RESOLVED WORKSFORME Alias: None Product: gcc Classification: Unclassified Component: c++ (show other http://forum.arduino.cc/index.php?topic=116585.0 bugs) Version: unknown Importance: P3 enhancement Target Milestone: --- Assignee: Not yet assigned to anyone URL: Keywords: Depends on: Blocks: Reported: 2010-04-29 20:12 UTC by David Rothlisberger Modified: 2010-04-30 14:01 UTC (History) CC List: 1 user (show) gcc-bugs See Also: Host: Target: Build: Known to work: Known to fail: Last reconfirmed: Attachments Add an attachment (proposed patch, testcase, etc.) Note in function You need to log in before you can comment on or make changes to this bug. Description David Rothlisberger 2010-04-29 20:12:55 UTC I know that dozens of bugs have been opened for this over the years, but please read this through. If you have a C++ program missing a return statement from a function that is supposed to return a value, g++ will compile it happily with no errors (or even a warning, unless -Wreturn-type or -Wall in function returning is used). Trying to use the return value from the function will most likely cause a segmentation fault. Dozens of bugs have been opened for this over the years (e.g. bug 11474), all rejected as invalid based on the following statement from section 6.6.3 of the C++ standard: Flowing off the end of a function is equivalent to a return with no value; this results in undefined behavior in a value-returning function. However, the very same paragraph begins with: A return statement without an expression can be used only in functions that do not return a value, that is, a function with the return type void, a constructor (12.1), or a destructor (12.4). In my opinion, the standard contradicts itself. Either flowing off the end of a function is "equivalent to a return with no value" (i.e. invalid according to the beginning of the paragraph) or it is "undefined behaviour". It can't be both. Appendix C is informative rather than normative, but can help us understand the intent of the standard. Section C.1.4 says: Change: It is now invalid to return (explicitly or implicitly) from a function which is declared to return a value without actually returning a value. Rationale: The caller and callee may assume fairly elaborate return-value mechanisms for the return of class objects. If some flow paths execute a return without specifying any value, the impleme
> Programming Questions > return-statement with a value, returning 'void' Print Go Down Pages: [1] Topic: return-statement with a value, returning 'void'(Read 3762 times) previous topic - next topic KE5QDA Newbie Posts: 16 Karma: 0[add] return-statement with a value, returning 'void' Jul 30, 2012, 11:33 pm Here is the calling piece: tuneWord = float(buffer1); convTuningWord(); Serial.write(freq); //write freq FA to pc mySerialA.print(AresetDDS, '0');/* End of FA: Frequency query command and response VFO A */Here is the function:void convTuningWord() { freq = ((CLK*tuneWord)/TUW); //converts tuning return freq; //word to frequency }This is the only error I get on trying to compile. I've already checked all my '{' and '}' and they are correct. So, I'm lost. Arrch Faraday Member Posts: 3,458 Karma: 104[add] Re: return-statement with a value, returning 'void' #1 Jul 30, 2012, 11:38 pm Your function as written says you don't need to return anything (void), yet you try returning god knows what type of variable called freq. Tom Carpenter Edison Member Posts: 1,787 Karma: 140[add] Once the magic blue smoke is released, it won't go back in! Re: return-statement with a value, returning 'void' #2 Jul 30, 2012, 11:41 pm 'void' means doesn't have a type. You cant return a variable from a void function.You also have to declare variables that you are sending to a function, i.e: tuneWord Essentially, you have declared your function as:void convTuningWord(void);Which means you can neither pass a variable to it, nor return one.Perhaps this is what you mean:Code: [Select]
someReturnType convTuningWord(someType tuneWord) {
someReturnType freq = ((CLK*tuneWord)/TUW); //converts tuning
return freq; //word to frequency
}Where 'someType' is whatever tuneWord is (e.g. float, int, long), and 'someReturnType' is whatever type freq is (e.g. float, int, long). I cant tell from the code you have posted what they should be.Alternatively, if freq and tuneWord are global variables, you can just do this:Code: [Select]
void convTuningWord() {
freq = ((CLK*tuneWord)/TUW); //converts tuning
return; //You dont need to return anything as freq is stored globally anyway
} ~Tom~ KE5QDA Newbie Posts: 16 Karma: 0[add] Re: Success #3 Jul 31, 2012, 01:53 am This newbie changed the word void to the word float and everything