Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / remend bug

Author
Message
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Apr 2008 21:17
While trying (unsuccessfully ) to reproduce an incorrect line number error message on the following thread

http://forum.thegamecreators.com/?m=forum_view&t=75242&b=15

I encountered the following strange bug:



This bug has caused me a bit of pain when debugging programs using remstart/remend pairs.
Twinsen
17
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Apr 2008 21:51
hmm what's the bug ?

Could you help me treat my injured Dino-Fly ?
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 13th Apr 2008 22:19 Edited at: 13th Apr 2008 22:20
I don't see the bug. A remend anywhere can end a remark block, it doesn't have to be at the start of a line. At least, I think this is intended functionality.

Twinsen
17
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Apr 2008 22:30
why use it anyway ??? I always use `

Could you help me treat my injured Dino-Fly ?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Apr 2008 00:57 Edited at: 14th Apr 2008 00:58
Quote: "hmm what's the bug ?"


Quote: "I don't see the bug."


Nelson lookalikes, eh?

Quote: "A remend anywhere can end a remark block, it doesn't have to be at the start of a line."


Not true. Perhaps you'd all like to explain what you think happens when the following snippets are compiled and run:

Snippet 1



Snippet 2



Snippet 3



Snippet 4



This is either a bug or the behaviour of the text remend needs to be spelt out carefully.

Quote: "why use it anyway ??? I always use `"


Do you really comment out, say, 50 lines of code one line at a time when you are de-bugging long programs?
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 14th Apr 2008 01:09 Edited at: 14th Apr 2008 01:17
[edit] I just actually ran the snippets (as I only compiled them prior to posting) and snippet 2 quits? Strange

Twinsen
17
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 14th Apr 2008 07:35
what ???? why does it quit ???

Could you help me treat my injured Dino-Fly ?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Apr 2008 18:13
Quote: "and snippet 2 quits? Strange "


Aah! Light is beginning to dawn then.

How does the behaviour of the last 3 snippets fit in with your earlier explanation?
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Apr 2008 19:36 Edited at: 14th Apr 2008 19:37
I think this covers the logic:

1. Remstart = ignore proceeding code until remend
2. Remend = end remstart
2. Remend = error if no preceeding remstart

The footnote is that the commands must be surrounded by spaces or line endings, otherwise they are ignored. So...

`remend

is ignored whereas

` remend

is not. Therefore you can place remend on a new line, or at the end of an existing line to suit your coding tastes, rather like } in C++ or Java.

I don't think it's the best way to do it, but the logic explains it.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Apr 2008 21:09
Quote: "The footnote is that the commands must be surrounded by spaces or line endings, otherwise they are ignored. So...

`remend

is ignored "


In which case you need to study snippet 4 again.
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Apr 2008 23:02
Yep, that blows my idea out of the water
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Apr 2008 20:24 Edited at: 16th Apr 2008 20:45
Quote: "How does the behaviour of the last 3 snippets fit in with your earlier explanation?"

It doesn't.

So far to me it seems a comment block is closed if the remend appears at the third+ character of a single-line comment. It's not very precise logic but it's all I can narrow it down to. So:

Works:


Doesn't work:


Also doesn't work:


But what about these two snippets?





It's as if the logic in my first post applies only when the remend isn't on a comment, otherwise we get this strange behaviour - as if it's actually processing (incorrectly) single-line comments inside a comment block.

Also, it seems there is no error reported when a comment block isn't closed (as in snippet 2 in your post).

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Apr 2008 21:33
Beginning to look like we all agree something is wrong.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 13th Feb 2011 22:49
Quote: "Do you really comment out, say, 50 lines of code one line at a time when you are de-bugging long programs? "

it is not required to comment big pieces of code manually: DBPro has 2 buttons for comment and uncomment selected text (in "edit" buttons line)
these buttons adds or removes "//" at a start of each line.

maybe "//" commented lines will not have buggs

Cheers

Join The dark Side! We have cookies
thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 14th Feb 2011 02:10
Would this have anything to do with this problem, also with REM? Case still works inside REM

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Feb 2011 12:21
Quite possibly.

Login to post a reply

Server time is: 2024-03-28 19:26:14
Your offset time is: 2024-03-28 19:26:14