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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:46:07+00:00 2026-06-13T05:46:07+00:00

I have a projectgroup in which all Win32 programs have the same ..\PatchLibs search

  • 0

I have a projectgroup in which all Win32 programs have the same ..\PatchLibs search path.
This folder contains a patched System.Win.Ctrl.pas containing:

{$IFDEF WIN32}
function _malloc(size: size_t): Pointer; cdecl;
begin
  if (size > MaxInt) then 
  begin                   
     Result := Nil
  end
  else
  begin
     try
        Result := AllocMem(size);
     except
        Result := Nil;
     end;
  end;
end;

[This patch suppresses an error in midaslib (QC 104337)]

The issue:

One of the (smaller) projects gives a W1023 (“comparing signed and unsigned types”) compiler warning on the ‘MaxInt’ line, all others build without warnings.
None of the projects have System.Win.Ctrl in their uses statements or in their project files.

Thinking there might be two typed constant definitions for Maxint I wanted to prefix Maxint with the ‘correct’ unit name, but can’t find its definition.
I have searched through all available c:\program files (x86)\embarcadero\rad studio\9.0\source*.* files, but found no definitions.
System.MaxInt works but does not eliminate the warning.
Typecasting Cardinal(MaxInt) removes the warning, but I’d still prefer the ‘fully qualified’ solution.
(size_t is defined as ULONG_PTR is defined as NativeUInt)
I found Quality Central issue 102873, 69836 and 53202 but these refer to duplicate definitions C++ .h header files

Is my assumption about more than one definition correct? If so, what would/should the unit prefix be?
And most important: why do I get the compiler warning for that one project build only?

  • 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-06-13T05:46:08+00:00Added an answer on June 13, 2026 at 5:46 am

    MaxInt is declared in the System unit. I’m pretty sure that’s the only MaxInt that is in scope here. The warning you see is accurate. MaxInt is signed and size_t is unsigned. You should suppress the warning. For example you could cast MaxInt to size_t:

    if size > size_t(MaxInt) then
    

    That’s fine because MaxInt is within the range of values of size_t.

    As an aside, I’d probably deal with the underlying issue by hooking the function that needs fixing, rather than re-compiling the entire unit. I personally find that to be less invasive and easier to maintain.


    Why do I get the compiler warning for that one
    project build only?

    Some ideas:

    1. You only have one project that includes that unit.
    2. You have different compiler options in different projects. Perhaps only one of your projects has warnings enabled, or only one project has that specific warning enabled.
    3. You only have one project with WIN32 defined.
    4. This file is only compiled once, but used multiple times. Perhaps because you are making rather building.

    It’s pretty hard to explain that part of your question. Irrespective, when the code in your question is compiled with warnings enabled, you will get that warning. You really are comparing signed and unsigned. So you really do need to suppress the warning with the method I provide above.

    Remember that a warning does not mean that your code is broken. Suppressing that warning will not change the behaviour of the code. When you see that warning you analyse the code to check whether or not there is a problem. In this case, the code works fine and you just need to suppress the warning.

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

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
Have deployed numerous report parts which reference the same view however one of them
Have a SQL problem, adding this model all works correctly, the problem is in
I have been working on a system which I'm using protobuf-net (version 2.0.0.480) for
I'm a little puzzled with this one. I have a Collection called AllProducts, which
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
Have I in some way delete this Task or it is self-destroyed? Task.Factory.StartNew(() =>
I have the following LINQ query which will group by a column and add
I have an enum like this: public enum ProductGroup { A = 1, B

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.