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

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: 7728
Joined: Wed Jul 09, 2003 10:30 pm

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

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: 7728
Joined: Wed Jul 09, 2003 10:30 pm

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

Post by cccp_leha »

Thanks for the info.
User avatar
Hirogen2
Posts: 2030
Joined: Sat Jul 19, 2003 6:15 am
Github ID: jengelh
Operating System: RedHat-like Linux (RHEL, Fedora, CentOS, etc) 64-bit
Graphics Processor: Intel with Vulkan Support
Location: Central Germany

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

Post by cccp_leha »

Prints nothing.

Return to “Closed Bugs”