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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:02:19+00:00 2026-05-23T14:02:19+00:00

I am porting an application from 32 bit to 64 bit. The application includes

  • 0

I am porting an application from 32 bit to 64 bit. The application includes gSoap generated ANSI C source code. The prototypes of several generated soap functions include int data types in the argument list, such as:

int PASCAL FAR setsockopt (
                       __in SOCKET s,
                       __in int level,
                       __in int optname,
                       __in_bcount_opt(optlen) const char FAR * optval,
                       __in int optlen);

But, when called in stdsoap2.c, the 5th argument in this example is passed the sizeof macro:

if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger)))
{ ...
}

The sizeof macro returns a value of the size_t type which is just an unsigned int. When compiling in the 32 bit environment, this presented no problem, however, when compiling in the 64 bit environment, the warning: "Conversion from unsigned __int64 to int might lose data".

I understand the data loss problem. My question is where and how should it be placed in the code to address the problem short of (int) type casting for each sizeof macro being passed as an int within stdsoap2.c (there are 32 warnings in stdsoap.c alone). I would like to avoid editing an automatically generated source file if possible.

For those familiar with gsoap methods, I have included the following:

#ifdef WITH_SOAPDEFS_H
# include "soapdefs.h"      /* include user-defined stuff */
#endif

and am using soapdefs.h in my project. This file has project wide scope, perhaps this file would be a good place for addressing the problem, then the question would just be how?

  • 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-23T14:02:20+00:00Added an answer on May 23, 2026 at 2:02 pm

    size_t isn’t “just an unsigned int“; as the warning shows, on a 64-bit platform it’s commonly larger than that.

    Where you should do the check depends on the application, but if you’re passing the value of a sizeof expression, you could replace that with an appropriately defined constant:

    enum {
        SIZEOF_LINGER = sizeof(struct linger);
    };
    

    The compiler will issue a warning if the constant is too large to be converted, so if you compile with (the equivalent of GCC’s) -Wall -Werror, you’re safe.

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

Sidebar

Related Questions

I'm porting my application from 32 bit to 64 bit. Currently, the code compiles
I'm porting a C++ application from Unix and the original developer created several files
Porting an application from C# (1.1 framework) to VB.NET (3.5 framework), and I have
While porting an application from SQL 2005 to SQL Server Compact Edition, I found
I am porting an application from iPhone to BlackBerry. BlackBerry apps tend not to
I'm porting my application from Winforms+XNA to WPF (+ XNA?) and I would like
I am porting my application to windows from Linux. I am fairly new to
I'm porting a small C++ console application from windows to linux, GCC 4.3.2. When
Pretty clear from the title itself, what is meant by porting an application X
Question appears during porting application from JSF 1.2 to JSF 2.0.3 (Mojarra). I have

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.