[Github-comments] [geany/geany] Push current position to navqueue before navigating back (#1537)

elextr notifications at xxxxx
Sun Jul 16 00:54:39 UTC 2017


> This is existing behavior. The navqueue uses the filename as a unique identifier of a document. (It doesn’t really need them right now, because it evicts a document from the navqueue once it is closed — so could use a GeanyDocument * — but the comments there mention fixing that as a to-do.)

Using filenames (even with the macro) is broken, more than one untitled can be opened, and Geanydocument pointers are reused so thats not a solution. Should use the document id, that is unique in a session, but as you say thats an existing problem.

> That's just using different words to say "code". There's a contract established in the code that says whether a document can be NULL or not at a particular point in a program (for example, upon entrance to a function).

Yes, but its not a local contract, and its not an entry contract, its not even a contract thats reified in the program, so its easy to break.  

> The error should never reach the user in a release build because any PR changing behaviour needs to check all the places affected (ex. something messing with action sensitively needs to test all of the features that rely on it). IMO, it's bad style to just make the program behave wrongly or carry on like nothing is wrong and crash later, far away from the error.

Nice theory, but in practice all the possible combinations are not tested every time something changes.  Programmers, reviewers and testers (at least the motley crew here) are human, that is to say fallible, so even though its "bad style" it happens, especially when the dependency is not obvious.

And just to emphasise what @codebrainz says about undefined behaviour, if something relies on undefined behaviour  the compiler and/or runtime is allowed to do anything it likes, eat your shorts, send your bank data to "scammers-r-us", anything.  Its rare, but it happens, the Linux Kernel had a bug recently where code invoking UB caused the compiler to decide that an if condition was always false, so it removed a block of code, which of course caused problems.  So yes compilers doing strange things in the face of UB does happen, even in code far better reviewed and tested than Geany.  

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1537#issuecomment-315573656
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170715/0441f0c4/attachment.html>


More information about the Github-comments mailing list