Sclerocephalus Posted October 16, 2013 Author Share Posted October 16, 2013 The compiler does little or no error checking. We learned that with value(less) returns in value returning functions. My guess is this is a relatively smart guy, who had heard of recursive descent compilers, but never formally took a class. Errr... actually, the valueless "return" works in the same way as you probably know it from other programming languages. I recently needed to have a look at this myself because I was somewhat confused about the use of it in some scripts from recent mods. I also remember that I had read a comment on the CK Wiki stating that "return" without a return value passes only due to a bug in the papyrus compiler (and saying between the lines that this actually won't work). Though, this comment doesn't exist anymore. Instead, it does now read as follows (implying that it does work anyway): http://www.creationkit.com/Return_%28Papyrus%29#Return_Statement Link to comment Share on other sites More sharing options...
Arthmoor Posted October 16, 2013 Share Posted October 16, 2013 Unless I'm missing something it's saying an empty return in a function that, for example, should return bool will instead return None. Which would be bad, yes? Link to comment Share on other sites More sharing options...
NightStar Posted October 17, 2013 Share Posted October 17, 2013 That's how I read it too; so yes, it would be bad. Link to comment Share on other sites More sharing options...
Sclerocephalus Posted October 17, 2013 Author Share Posted October 17, 2013 Unless I'm missing something it's saying an empty return in a function that, for example, should return bool will instead return None. Which would be bad, yes? "If a function with a return type exits without a return statement, then None will be returned" The case of a function with a return type exiting with an empty return is not covered by the comment, but I remember vaguely that this resulted in a compiler error. Link to comment Share on other sites More sharing options...
DayDreamer Posted October 17, 2013 Share Posted October 17, 2013 The case of a function with a return type exiting with an empty return is not covered by the comment, but I remember vaguely that this resulted in a compiler error. You can of course test this yourself, but no -- there is no compiler error. I submitted a whole raft of these hand checked for bool, and they've been fixed. That immediately fixed a bunch of oddball bugs! Someday, I'll look for missing int returns.... Link to comment Share on other sites More sharing options...
Arthmoor Posted October 27, 2013 Share Posted October 27, 2013 [08/17/2013 - 01:48:42AM] Error: Unable to call RegisterForSingleUpdate - no native object bound to the script object, or object is of incorrect type stack: [None]._StarMain.RegisterForSingleUpdate() - "<native>" Line ? [None]._StarMain.OnUpdate() - "_StarMain.psc" Line ? I triple dog dare someone to come up with an explanation for that. Hana just got it in a log tonight. Link to comment Share on other sites More sharing options...
Sclerocephalus Posted October 27, 2013 Author Share Posted October 27, 2013 Where is "_StarMain.psc" from ? I can't find any vanilla script that starts with an underscore. Link to comment Share on other sites More sharing options...
Arthmoor Posted October 27, 2013 Share Posted October 27, 2013 Turned out to be from a mod - Shooting Stars. So just another infamous [None] error. Link to comment Share on other sites More sharing options...
DayDreamer Posted October 28, 2013 Share Posted October 28, 2013 EDIT: My mistake, I was reading it the wrong way. But a good example of correct usage of single update preventing an infinite loop during an error! Link to comment Share on other sites More sharing options...
Arthmoor Posted October 28, 2013 Share Posted October 28, 2013 Heh, well I'd hope by now that most folks understand that using the single update registrations is the only sane choice. Link to comment Share on other sites More sharing options...
Sclerocephalus Posted October 28, 2013 Author Share Posted October 28, 2013 Heh, well I'd hope by now that most folks understand that using the single update registrations is the only sane choice. Even the Ck Wiki got aware now of that problem (this page has been modified relatively recently: http://www.creationkit.com/RegisterForUpdate_-_Form Link to comment Share on other sites More sharing options...
DayDreamer Posted October 28, 2013 Share Posted October 28, 2013 Even the Ck Wiki got aware now of that problem (this page has been modified relatively recently: http://www.creationkit.com/RegisterForUpdate_-_Form That was 2012 10-21, over a year ago. :grin: Hopefully everybody took it to heart! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now