In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "why C++ doesn't use all uppercase enumerated values". The content in the article is simple and clear, and it is easy to learn and understand. let's study and learn why C++ doesn't use all uppercase enumerated values.
Enum.5: do not use all uppercase enumerated values
Reason (reason)
Avoid conflicts with macro definitions.
Example, bad (negative example)
/ / webcolors.h (third party header)
# define RED 0xFF0000
# define GREEN 0x00FF00
# define BLUE 0x0000FF
/ / productinfo.h
/ / The following define product subtypes based on color
Enum class Product_info {RED, PURPLE, BLUE}; / / syntax errorEnforcement (implementation recommendation)
Marks all uppercase enumerated values.
Thank you for your reading, the above is the content of "Why C++ does not use all uppercase enumerated values". After the study of this article, I believe you have a deeper understanding of why C++ does not use all uppercase enumerated values. the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.