CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: XML related

  1. #1
    Join Date
    May 2015
    Posts
    500

    XML related

    Hello,
    May be instead of original XML Q (asked here before thinking a bit), I'll ask another one.

    I have to add a constant which has max value lets say :
    const unsigned short A1_MAX = 100;

    And use the same const to check the invalids, I guess I can check something like if the value is A1_MAX+1..Or is it better to define

    const unsigned short A1_INVALID = A1_INVALID+1;

    to look neat in the code ? Sorry just asking in terms of neatness and tidiness of code..


    Thanks a lot
    Stay safe
    pdk
    Last edited by pdk5; April 30th, 2020 at 12:18 AM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: XML related

    I'd set the max allowed/valid value as
    Code:
    #define A1_MAX_VALID_VALUE  (100)
    However it is just up to you...
    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: XML related

    if the value is A1_MAX+1
    Are you checking for < A1_MAX + 1 ? If so, you can just check for <= A1_MAX
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    May 2015
    Posts
    500

    Re: XML related

    Thanks a lot kaud , yes I can do that

  5. #5
    Join Date
    May 2015
    Posts
    500

    Re: XML related

    , thanks a lot for responding, I know I should do some home work before posting here

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured