Understanding a Compiler-Specific Issue

Правка en1, от areke, 2015-12-07 01:03:48

Hi everyone!

I'm having trouble with my submission for problem 382A.

The lines in question are commented in the submission above, but I'll highlight them here as well for clarity.

Using the following passes all the test cases:

    long long len = w2.length();
    len -= w1.length();
    len = absol(len-1);

While using this instead fails the first one, but returns the correct answer on my local machine:

    long long len = absol(w2.length()- w1.length()-1);

Does anyone have an idea of what's going on at a technical level?

My best guess is that it has something to do with precedence, and that in the second case the function address is being returned instead of the actual length. I'm not sure if this is the problem though and I've never run into something like this before.

I've tried doing a bunch of research on this issue, but haven't yet been able to find the answer. I'm hoping the great Codeforces community can help me out!

Thank you guys in advance!

Теги c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский areke 2015-12-07 01:03:48 1122 Initial revision (published)