Jump to content
  • Advertisement
Sign in to follow this  
Thirthe

[C/C++] reserved keywords and regex

This topic is 3864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, i've gotten an assignment of matching some patterns, and whilst i solved the rest of the assignment, i'm stuck at the easiest part of it - matching C and C++ reserved keywords. when i run it through the system that checks whether i passed the assignment or not it said that my regex only matched in 72 out of 77 cases. so now i'm asking.. which reserved keywords have i forgotten? i've used the list here: http://lib.daemon.am/Books/C/apb/apb.htm shouldn't this be correct:
\<(catch|inline|template|class|new|this|delete|operator|throw|except|private|try|finally|protected|virtual|friend|public|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\>

note: i'm doing this in OpenOffice, so there are some minor differences. \< equals ^ \> equals $

Share this post


Link to post
Share on other sites
Advertisement
It looks like you're missing namespace, typename, mutable and explicit.

(Oh, and except and finally aren't keywords in C or C++.)

You also forgot the casts: static_cast, const_cast, dynamic_cast, and reinterpret_cast.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!