[Not a bug] good old print()

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

good old print()

Postby cccp_leha » Fri Nov 14, 2003 7:47 pm

I somehow stumbled across the following. If try you concatenate with a "+" like so:
Code: Select allExpand view
print(s:"this is togethered by " + "a plus");

it compiles with no errors, but prints out a different message, most likely the first one immediately following it in the code. blabla, not sure if this is a bug, blabla.
User avatar
cccp_leha
Words are silver; silence is gold... so stfu.
 
Joined: 16 Jul 2003
Location: NJ, USA

Postby randi » Fri Nov 14, 2003 7:48 pm

No, it's not a bug, since ACC doesn't have an actual string type. Strings are just numbers that can be manipulated like any other number.
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Postby cccp_leha » Fri Nov 14, 2003 8:11 pm

Hah, I knew it wasn't a bug. And why does it print an irrelevant message?
User avatar
cccp_leha
Words are silver; silence is gold... so stfu.
 
Joined: 16 Jul 2003
Location: NJ, USA

Postby randi » Fri Nov 14, 2003 8:28 pm

Because you're adding two different numbers together to get a different number. Suppose those two strings are numbers 1 and 2 in the string table. Then your code is equivalent to this:
Code: Select allExpand view
print(s:1 + 2);

So it will print the string at index 3.
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Postby cccp_leha » Fri Nov 14, 2003 8:57 pm

Thanks for the info.
User avatar
cccp_leha
Words are silver; silence is gold... so stfu.
 
Joined: 16 Jul 2003
Location: NJ, USA

Postby Hirogen2 » Sat Nov 15, 2003 1:30 am

randy wrote:Because you're adding two different numbers together to get a different number. Suppose those two strings are numbers 1 and 2 in the string table. Then your code is equivalent to this:
Code: Select allExpand view
print(s:1 + 2);

So it will print the string at index 3.

What if there is no index 3 in the ACS file? Segfault? Printing the byte opcodes?
User avatar
Hirogen2
 
Joined: 19 Jul 2003
Location: Central Germany
Github ID: jengelh
Operating System: RedHat-like Linux (RHEL, Fedora, CentOS, etc) 64-bit
Graphics Processor: Intel (Modern GZDoom)

Postby cccp_leha » Sat Nov 15, 2003 3:18 pm

Prints nothing.
User avatar
cccp_leha
Words are silver; silence is gold... so stfu.
 
Joined: 16 Jul 2003
Location: NJ, USA


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 2 guests