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

  • SEARCH
  • Home
  • 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 357785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:14:17+00:00 2026-05-12T12:14:17+00:00

I can’t search for | in Google. If you had found it in a

  • 0

I can’t search for | in Google. If you had found it in a software source code that you are trying to interpret, you didn’t know what it does and you couldn’t ask other people for help, how would you find out what it does?

  • 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-12T12:14:17+00:00Added an answer on May 12, 2026 at 12:14 pm

    The pipe operator in this case means “use both SWT.APPLICATION_MODAL and SWT.OK as options/flags for my popup box.” It’s a very commonly used idiom with bitfield configuration identifiers, esp. in windowing systems like SWT or Win32.

    How it works

    The pipe (|) operator is the bitwise OR operator, that is, it computes an OR operation of the two binary integer values. If you check out where APPLICATION_MODAL and OK are defined, you’ll find they are something like this:

    ...
    SWT.OK = 1,                  // 00000001 in binary
    SWT.ABORT_RETRY_IGNORE = 2,  // 00000010 in binary
    SWT.OK_CANCEL = 4;           // 00000100 in binary
    ...
    SWT.APPLICATION_MODAL = 32;  // 00100000 in binary
    ... (and so on...)
    

    When you bitwise OR two (or more) of these numbers together, individual bits will be set for each of the options:

    int style = SWT.OK | SWT.APPLICATION_MODAL = 00000001 | 00100000 = 00100001
    

    The windowing toolkit that goes to interpret style will be able to tell exactly what you wanted (a popup box that is Modal and has an OK button) by doing a bitwise AND like this:

    ...
    if(style & SWT.OK)
    {
        // we want an OK box
    }
    if(style & SWT.ABORT_RETRY_IGNORE)
    {
        // we want an Abort/Retry/Ignore box
    }
    if(style & SWT.OK_CANCEL)
    {
        // we want an OK/Cancel box
    }
    ...
    if(style & SWT.APPLICATION_MODAL)
    {
        // We want a modal box
    }
    ...
    

    Kinda clever, in my humble opinion. It allows you to select/represent multiple configuration options in a single variable. The trick is in the integer definitions of the options, and ensuring that they are only powers of 2.

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

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
Can i get the source code for a WAMP stack installer somewhere? Any help
Can somebody point me to a resource that explains how to go about having
Can you cast a List<int> to List<string> somehow? I know I could loop through
Can a LINQ enabled app run on a machine that only has the .NET
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
Can anyone tell me what i am doing wrong? I am trying to get
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Can anyone help me with an excel formula that groups related rows and creates
Can we use the asterisk character * for a search action in SQL database?

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.