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

fixed cross initialization with jump to label in cpp #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DarekParodia
Copy link

@DarekParodia DarekParodia commented Nov 25, 2024

I've encoutered an error while working with c++17 that prohibited jumping into a case label that crosses the initialization of a variable.

/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3066:22: error: jump to case label
 3066 |                 case SelectionNotify: {
      |                      ^~~~~~~~~~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3153:22: error: jump to case label
 3153 |                 case FocusIn:
      |                      ^~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3160:22: error: jump to case label
 3160 |                 case FocusOut:
      |                      ^~~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3166:22: error: jump to case label
 3166 |                 case EnterNotify: {
      |                      ^~~~~~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3174:22: error: jump to case label
 3174 |                 case LeaveNotify: {
      |                      ^~~~~~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3180:22: error: jump to case label
 3180 |                 case ConfigureNotify: {
      |                      ^~~~~~~~~~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:3199:17: error: jump to case label
 3199 |                 default: {
      |                 ^~~~~~~
/home/darekparodia/Documents/programowanie/srv-monitor/include/RGFW.h:2938:32: note:   crosses initialization of ‘XEvent reply’
 2938 |                         XEvent reply = { ClientMessage };
      |                                ^~~~~

after moving Xevent reply = { ClientMessage }; outside switch case it compiled and worked properly. I haven't encoutered any more issues yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant