Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several issues in code #118

Closed
HarpyWar opened this issue Nov 7, 2014 · 1 comment

Comments

@HarpyWar
Copy link
Member

commented Nov 7, 2014

Need C++ programmers who can explore next situations in the code. There are possible problems described by the links.

1) http://www.viva64.com/en/d/0326/print/ (FIXED in #133 )

(code)

V690 The 'iterator' class implements a copy constructor, but lacks the '=' operator. It is dangerous to use such a class. elist.h 75

2) http://www.viva64.com/en/d/0121/print/

(code)

V532 Consider inspecting the statement of '*pointer++' pattern. Probably meant: '(*pointer)++'. anongame_wol.cpp 568

(code)

V532 Consider inspecting the statement of '*pointer++' pattern. Probably meant: '(*pointer)++'. handle_wol_gameres.cpp 651
V532 Consider inspecting the statement of '*pointer++' pattern. Probably meant: '(*pointer)++'. handle_wol_gameres.cpp 652
V532 Consider inspecting the statement of '*pointer++' pattern. Probably meant: '(*pointer)++'. handle_wol_gameres.cpp 653
V532 Consider inspecting the statement of '*pointer++' pattern. Probably meant: '(*pointer)++'. handle_wol_gameres.cpp 654

(code)(FIXED in #172)

V532 Consider inspecting the statement of '*pointer++' pattern. Probably meant: '(*pointer)++'. topic.cpp 233

@HarpyWar HarpyWar added this to the PvPGN 2.0 milestone Nov 8, 2014

@cen1

This comment has been minimized.

Copy link
Collaborator

commented Dec 23, 2014

  1. If I am not mistaken you simply need to define the = operator:
void operator=(const iterator& op) const {
  ptr = op.ptr;
}

However, I am wondering what this elist is used for elsewhere in the code anyway. Seems like a normal stl list to me.

2 http://stackoverflow.com/questions/4423703/in-c-how-does-the-expression-pointer-work apparently ++ has higher priority than * so it will first increment the pointer and then dereference it. Check if that is actually the intended behaviour and add () for clarity. Surprisingly good warning messages. :D

I suspect in the code samples, it works as intended because it first checks if current value is token separator: if ((*p == ',') || (*p == ' ')) { and then it increments to the actual token first.

So, making it *(ptr++) everywhere should surpress the warning and not break stuff.

Kelwing added a commit to Kelwing/pvpgn that referenced this issue Feb 10, 2015
HarpyWar added a commit that referenced this issue Feb 11, 2015
Merge pull request #133 from Kelwing/master
Fixed the first issue in #118
HarpyWar added a commit that referenced this issue Jun 28, 2015
Merge pull request #142 from cen1/118
Fixed a warning from Ref #118. Plus has priority over dereference. I was...

@RElesgoe RElesgoe closed this May 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.