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 497451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:46:58+00:00 2026-05-13T05:46:58+00:00

When defining a callback proc in Xt (for example XtTimerCallbackProc ), client_data is specified

  • 0

When defining a callback proc in Xt (for example XtTimerCallbackProc), client_data is specified as an XtPointer. Is it safe to pass an int via client_data, rather than an actual pointer, and cast it back inside the procedure?

For example:

void foo(void) {
   ...
   int data = 1;
   XtAppAddTimeout(app_context, 1000, timer_cb, data);
   ...
}

void timer_cb(XtPointer client_data, XtIntervalId *timer)
{
   int my_data = (int) client_data;
   ...
}
  • 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-13T05:46:58+00:00Added an answer on May 13, 2026 at 5:46 am

    It should be safe, but you should use an integer type that have the same size as a pointer.

    The standard C99 type uintptr_t can be used for this purpose.

    As per comments point out, int->ptr->int is not guaranteed by the use of this type. It should work more than often, but it is not as per specifications.

    The alternative is to pass a pointer. If your app is single threaded, you might just do

    static int data; and passs &data. If your app needs to be reentrant, then malloc an int.

    As a matter of fact, I don’t think the standard support int->ptr->int in any way.

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

Sidebar

Related Questions

Defining some Tables in SQL-Server which will be accessed via ODBC from MS-Access. I'm
; defining stream-for-each (define (stream-for-each proc s) (if (stream-null? s) 'done (begin (proc (stream-car
I am defining @foo as a class instance attribute, and using the after_initialize callback
Defining page arguments is useful because you can call the same callback from different
In Cocoa/Objective C, are static class methods thread safe ? I am defining a
Defining custom components in Facelets is easy and quick but there's one thing I
When defining a method on a class in Python, it looks something like this:
When defining parameter type that is e.g. in System.Data you have no intellisense and
Atleast defining my problem is simple... I have a Input control (Text) and a
When defining a custom operator from the limited set of single-character operators that can

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.