Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7183929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:05:47+00:00 2026-05-28T18:05:47+00:00

Here is some code that takes an int error code (scode) and tries to

  • 0

Here is some code that takes an int error code (scode) and tries to see if it fits a certain pattern. Should I be using the modulo division operator to be doing this?

const int MASK_SYNTAX_ERR = -2146827000;
if ((MASK_SYNTAX_ERR % scode) == MASK_SYNTAX_ERR)
    scriptError.GetSourceLineText(out sourceLine);

Background: I had to deduce the value of MASK_SYNTAX_ERR through observation. Here are the various syntax error codes that I observed:

// -Int Value (Formatted Value "0x{0:X8}")
-2146827281 (0x800A03EF)
-2146827279 (0x800A03F1)
-2146827280 (0x800A03F0)
-2146827283 (0x800A03ED)
-2146827284 (0x800A03EC)

Here are a couple of logic error codes for comparison:

-2146823281 (0x800A138F)
-2146823279 (0x800A1391)

(Trivia: The code itself is calling IActiveScriptError.GetSourceLineText, this is from a IActiveScriptSite.OnScriptError implementation.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:05:48+00:00Added an answer on May 28, 2026 at 6:05 pm

    The bitwise & operator is what you should use, like this:
    const int MASK_SYNTAX_ERR = -2146827000;
    if (MASK_SYNTAX_ERR & scode != 0)
    scriptError.GetSourceLineText(out sourceLine);

    More about what’s going on.

    The binary representation of MASK_SYNTAX_ERR is

    1000 0000 0000 1010 0000 0101 0000 1000

    This comparison will return true for any number that has 1’s in the same positions. Take your first syntax error code, for example:

    MASK 1000 0000 0000 1010 0000 0101 0000 1000
    CODE 1000 0000 0000 1010 0000 0011 1110 1111
       & 1000 0000 0000 1010 0000 0001 0000 1000 != 0
    

    So the mask works here. Now, comparing a logic error code:

    MASK 1000 0000 0000 1010 0000 0101 0000 1000
    CODE 1000 0000 0000 1010 0001 0011 1000 1111
       & 1000 0000 0000 1010 0000 0001 0000 1000 != 0
    

    It also works here, which it shouldn’t. It seems like maybe your deduced mask may be wrong because it is too complicated. Looking at your syntax codes and logic codes together:

    SYNTAX 1000 0000 0000 1010 0000 0011 1110 1111
           1000 0000 0000 1010 0000 0011 1111 0001
           1000 0000 0000 1010 0000 0011 1111 0000
           1000 0000 0000 1010 0000 0011 1110 1101
           1000 0000 0000 1010 0000 0011 1110 1100
    LOGIC  1000 0000 0000 1010 0001 0011 1000 1111
           1000 0000 0000 1010 0001 0011 1001 0001
    

    It looks like the 13th bit from the left is the key difference between logic errors and syntax errors. So you could do something like this:

    const int SYNTAX_MASK = 1 << 12;
    if (scode & SYNTAX_MASK != 0)
    {
        //It's a syntax error
        scriptError.GetSourceLine(out sourceLine);
    }
    else
    {
        //It's a logic error
    }
    

    You can use a similar analysis to figure out masks for other purposes. A lot of times, a mask is used to grab a single bit from an int, rather than something complicated like you had. It could be that the 0x800A part of the code means a certain kind of error, and the last part gives information about the error. You’ll have to do some experimentation yourself, but hopefully this will get you on the right track for doing bitmasks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that is using SyncEnumerator. As you can see here ,
I've got some code here that works great on IPv4 machines, but on our
So I have some PHP code that looks like: $message = 'Here is the
Given some JS code like that one here: for (var i = 0; i
Here's the situation: We have some generic graphics code that we use for one
Here's some example code: class Obj attr :c, true def == that p '=='
We have some old C code here that's built with nmake. Is there an
I have a piece of code here that i really could use some help
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
Here is some code I could not get to format properly in markdown, this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.