News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#11
Bug reports / Re: stdckdint.h bug report
Last post by ander_cc - Yesterday at 07:30:13 AM
Quote from: John Z on March 08, 2026, 09:26:14 PM👍👍👍

Definitely!  Thanks Timo.
Better output too -

    long int a = 65536;
    long int b = 65535;//10
    int c = 0;
---------output---------
result: true  c = -65536
result: false c = 131071
result: false c = 1
Press any key to continue...

John Z

Thank you for your reply, John Z.
The "long int" and the "int" are 32bit value in Pelles c.
I get the false when only the first argument overflow in function ckd_add, I think it is a bug.
#include <stdio.h>
#include <stdckdint.h>
int main(void)
{
int a = 655350;
int b = 10;
short int c = 0;

bool result = true;
result = ckd_add(&c, a, b); //out of range of short. a and b are int, c is short int.
if (result == true)
{
puts("true");
}else{
puts("false");
}
printf("c = %d ", c);

return 0;
}
#12
Bug reports / Re: stdckdint.h bug report
Last post by ander_cc - Yesterday at 07:23:31 AM
Quote from: TimoVJL on March 08, 2026, 03:10:42 PMhttps://cppreference.net/c/numeric/ckd_mul.html
thank you for your reply,  TimoVJL. I have read it. please try my test code.
Pelles C 13.01 will print :
false
c = 0
but gcc 15.2 will print :
true
c = 0

And I read the Pelles C help file for "stdckdint.h". I think the return value depends on first argument type. But Pelles C returns false when the first argument overflow in following code.
#include <stdio.h>
#include <stdckdint.h>
int main(void)
{
int a = 655350;
int b = 10;
short int c = 0;

bool result = true;
result = ckd_add(&c, a, b); //out of range of short. a and b are int, c is short int.
if (result == true)
{
puts("true");
}else{
puts("false");
}
printf("c = %d ", c);

return 0;
}
#13
Bug reports / Re: stdckdint.h bug report
Last post by John Z - March 08, 2026, 09:26:14 PM
👍👍👍

Definitely!  Thanks Timo.
Better output too -

    long int a = 65536;
    long int b = 65535;//10
    int c = 0;
---------output---------
result: true  c = -65536
result: false c = 131071
result: false c = 1
Press any key to continue...

John Z
#14
Bug reports / Re: stdckdint.h bug report
Last post by TimoVJL - March 08, 2026, 03:10:42 PM
https://cppreference.net/c/numeric/ckd_mul.html

Just easier to read:
#include <stdio.h>
#include <stdckdint.h>
char *ab[] = {"false", "true "};
int main(void)
{
    long int a = 655350;
    long int b = 655350;//10
    int c = 0;
    bool result;
    result = ckd_mul(&c, a, b); // ckd_add(&c, a, b); ckd_sub(&c, a, b);
    printf("result: %s c = %d\n", ab[result], c);

    result =  ckd_add(&c, a, b); // ckd_sub(&c, a, b);
    printf("result: %s c = %d\n", ab[result], c);

    result = ckd_sub(&c, a, b);
    printf("result: %s c = %d\n", ab[result], c);
    return 0;
}
#15
Bug reports / Re: stdckdint.h bug report
Last post by John Z - March 08, 2026, 10:13:46 AM
Hi Ander,

Well not always - If the numbers are big enough to 'wrap' you'll get 'true'
for example - output from code below :
true
c = -13107100
false
c = 1310700
false
c = 0
Press any key to continue...
#include <stdio.h>
#include <stdckdint.h>
int main(void)
{
    long int a = 655350;
    long int b = 655350;//10
    int c = 0;
    //int c = 0;
    bool result = true;
    result = ckd_mul(&c, a, b); // ckd_add(&c, a, b); ckd_sub(&c, a, b);
    if (result == true) {
        puts("true\n");
    }else{
        puts("false\n");
    }
    printf("c = %d\n", c);   
    result =  ckd_add(&c, a, b); // ckd_sub(&c, a, b);
    if (result == true) {
        puts("true\n");
    }else{
        puts("false\n");
    }
    printf("c = %d\n", c);
    result = ckd_sub(&c, a, b);
    if (result == true) {
        puts("true\n");
    }else{
        puts("false\n");
    }
    printf("c = %d\n", c);
    return 0;
}

Cheers,
John Z
#16
Graphics programming / Re: raylib 5.5 + PellesC v13.0...
Last post by rweidner - March 06, 2026, 08:48:41 PM
Quote from: TimoVJL on March 04, 2026, 05:19:10 PMThose libraries needs a RAD environment too to survive.
Just think what happened to Borland RADs.

Small programs are easy to develop with basic Win32 GUI.

Hi TimoVJL,

I agree with you - libraries tend to survive longer when they have a good RAD story around them, and Win32 GUI work can still be very productive with the right tools.

For context on why I am writing this raylib + PellesC tutorial: I am actively working on a 2D game in C using raylib right now. Once I finish it, I plan to do a couple of ports:

* Port 1: GDI + Win32 API (including input and sound)
* Port 2: Direct2D + Win32 API

Those ports are mostly for me: they are a learning project, and also an excuse to explore and document programming techniques. I enjoy writing tutorials, so I am trying to capture the "gotchas" and the practical setup steps as I find them.

Thanks again for chiming in on the thread.

Ronald
#17
Graphics programming / Re: raylib 5.5 + PellesC v13.0...
Last post by rapte - March 06, 2026, 04:28:21 PM
Thanks for the explanation :)
#18
Graphics programming / Re: raylib 5.5 + PellesC v13.0...
Last post by rweidner - March 06, 2026, 03:25:21 PM
The problem is that in C23 bool is a keyword.  What's happening here in the raylib.h on line 210 is:

// Boolean type
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
    #include <stdbool.h>
#elif !defined(__cplusplus) && !defined(bool)
    typedef enum bool { false = 0, true = !false } bool;
    #define RL_BOOL_TYPE
#endif

The developer is trying to define bool. There are fixes for this. The primary one is to fix the header and submit a pull request to the raylib project. But, I didn't go that route, yet. Instead, I changed to C17 and kept moving.
#19
Graphics programming / Re: raylib 5.5 + PellesC v13.0...
Last post by rapte - March 06, 2026, 02:27:50 PM
Thank you rweidner and Vortex for the detailed steps and examples on how to get raylib working with Pelles C.

I got the example working for both 32-bit and 64-bit and it works with c99, c11 and c17, but gives the following error with c23

Building main.obj.
C:\SDK\raylib-5.5\include\raylib.h(210): warning #2090: Missing enum tag.
C:\SDK\raylib-5.5\include\raylib.h(210): error #2002: Invalid combination of 'enum' and 'bool'.
C:\SDK\raylib-5.5\include\raylib.h(210): warning #2014: Empty declaration.
C:\SDK\raylib-5.5\include\raylib.h(210): error #2001: Syntax error: expected ';' but found '{'.
C:\SDK\raylib-5.5\include\raylib.h(210): error #2156: Unrecognized declaration.
C:\SDK\raylib-5.5\include\raylib.h(210): warning #2014: Empty declaration.

#20
Graphics programming / Re: raylib 5.5 + PellesC v13.0...
Last post by Vortex - March 05, 2026, 08:15:27 PM
Thanks, I managed to build the project without game_main.h  Here is a modified version :

Main project file :

#pragma comment(lib, "raylibdll.lib")

extern void raylibProc(void);

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    raylibProc();
    return 0;
}

Second module :

#include "raylib.h"

void raylibProc(void)
{
SetTraceLogLevel(LOG_NONE);
    InitWindow(800, 450, "raylib hello");
    SetTargetFPS(60);

    while (!WindowShouldClose())
    {
        BeginDrawing();
        ClearBackground(RAYWHITE);
        DrawText("Hello, raylib!", 190, 200, 40, BLACK);
        EndDrawing();
    }

    CloseWindow();
}

Default calling Convention : __cdecl