[Not a bug] good old print()

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

good old print()

Post by cccp_leha »

I somehow stumbled across the following. If try you concatenate with a "+" like so:

Code: Select all

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
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

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
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

Hah, I knew it wasn't a bug. And why does it print an irrelevant message?
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

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 all

print(s:1 + 2);
So it will print the string at index 3.
User avatar
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

Thanks for the info.
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Post by Hirogen2 »

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 all

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
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

Prints nothing.
Post Reply

Return to “Closed Bugs [GZDoom]”