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 09:19:51 AM
Quote from: Pelle on March 15, 2026, 11:32:37 AMI think ckd_<op>() came more or less straight from GCC to the C23 standard, and like some other GCC "innovations" it's a bit over-worked / under-thinked.

I will revise my initial implementation slightly, mostly just to reject more bogus cases -- like the original bug report.
Thank you, Pelle!
#12
Bug reports / Re: bug report. setvbuf() func...
Last post by ander_cc - Yesterday at 09:19:30 AM
Quote from: Pelle on March 15, 2026, 11:45:36 AMIn the low-I/O C runtime function _write(), when operating in text mode (ANSI/UTF-16LE/UTF-8/...), there is a ~2kB buffer for LF to CRLF translation. When this buffer is full, the content is sent to the destination (console/file/...), the buffer cleared, and the translation resumed. When resuming the translation the first character was lost (in translation).

( The printf family is one path to the _write() function )

Thank you, Pelle!
#13
Bug reports / Re: Creating resource with man...
Last post by TimoVJL - March 18, 2026, 11:39:45 PM
Just remove comments from xml file
like
    <!-- processorArchitecture="amd64" -->and use this line if it is common to X86 and X64
    processorArchitecture="*"
#14
Bug reports / Re: Creating resource with man...
Last post by PaoloC13 - March 18, 2026, 10:48:12 PM
I can't replicate the same problem because I uninstalled and reinstalled. It now compiles, but the .exe is broken. I suspect a file encoding issue (or some flag I haven't set?). You cannot view this attachment.
#15
General discussion / Re: Compiling using pomake
Last post by John Z - March 18, 2026, 08:57:56 PM
Yes, the povarsxx.bat files are generated at install time and are based on the directory (default, or user entered) during the install dialog.

To successfully run multiple versions is a bit more complicated however, thus the use of an xml file(s) as Timo mentioned.

John Z
#16
Announcements / Re: Release Candidate #1 for v...
Last post by Vortex - March 18, 2026, 07:05:24 PM
Hi Timo,

Thanks for the new tool. My result :

MOVBE not supported
#17
General discussion / Re: Compiling using pomake
Last post by rweidner - March 18, 2026, 06:31:26 PM
Quote from: TimoVJL on March 16, 2026, 08:09:44 PMHow project works with version 14 rc1 ?

It is possible to have many Pelles C versions in test PC


I interpreted this question in 2 different ways. Here are my interpretations and answers:

Interpretation 1:
Does project.bat work with PellesC 14?
Yes. I installed 14 RC 1 in the default location, and my program compiled and ran just fine using the project.bat script.

Interpretation 2:
What if a PellesC user has more than one version of PellesC on their PC? How would project.bat work in that case?

Somewhere near line 36 of project.bat there is a line like

call "%PROJECT_DIR%\env_pelles32.bat"
env_pelles32.bat:
@echo off
REM Sets PellesC environment for x86 builds.
call "C:\Program Files\PellesC\Bin\povars32.bat"

In case someone in the future reads this and doesn't already know, PellesC ships with 2 .bat files called:

- povars32.bat
- povars64.bat

This is what's in povars32.bat:
@echo off
set PellesCDir=C:\Program Files\PellesC
rem
echo Setting 32-bit environment for Pelles C...
rem
set PATH=%PellesCDir%\Bin;%PATH%
set INCLUDE=%PellesCDir%\Include;%PellesCDir%\Include\Win;%INCLUDE%
set LIB=%PellesCDir%\Lib;%PellesCDir%\Lib\Win;%LIB%

The answer to my interpretation of your question is, if someone had multiple PellesC installed and wanted to switch between them, at the moment they would need to modify env_pelles32.bat to point to the right version of PellesC. What I don't know is whether or not those 2 .bat files are dynamically generated at install time. (povars32.bat, povars64.bat) If not, they might also need some tweaks.

#18
Announcements / Re: Release Candidate #1 for v...
Last post by John Z - March 18, 2026, 04:04:09 PM
Nice work Timo - results on two Windows 7 systems -

DELL windows 7 Pro
GenuineIntel
Intel(R) Core(TM) Duo CPU  E8400 @ 3.00Ghz

MOVBE not supported


Sony Laptop windows 7 Home
GenuineIntel
Intel(R) Core(TM) Duo CPU  T6600 @ 2.20Ghz

MOVBE not supported


👍

John Z
#19
Beginner questions / Re: same code pelles c and gcc...
Last post by John Z - March 18, 2026, 03:44:17 PM
If (and a big if) I understand it, it appears the issue is the 'direction' of the counting

short int example

gcc and ChatGPT
a1 one:14  a1 zero:1
00000000 00000100 count left to right == 14 for 1st 1
00000000 00000100 count right to left ==  1 for 1st 0

Pelle version
a1 one:3  a1 zero:16
00000000 00000100 count right to left ==  3 for ist 1
00000000 00000100 count left to right == 16 for 1st 0

John Z
#20
Beginner questions / Re: same code pelles c and gcc...
Last post by rweidner - March 18, 2026, 02:11:00 PM
I didn't know the answer to this question. I asked ChatGPT.

QuoteChatGPT:

Assuming the usual widths on a typical modern desktop/compiler:

unsigned short = 16 bits

unsigned int = 32 bits

stdc_first_leading_one(x) returns the 1-based position of the first 1 when scanning from the most-significant bit (MSB).
stdc_first_leading_zero(x) returns the 1-based position of the first 0 when scanning from the MSB.

For 4, the bit pattern is ...00000100 (only bit 2 set, counting from LSB starting at 0):

First leading one is at position width - 2

First leading zero is at position 1 (because the MSB is 0 for the value 4)

So the output will be:

a1 one:14  a1 zero:1
a2 one:30  a2 zero:1

Explanation:

a1 (16-bit): 16 - 2 = 14

a2 (32-bit): 32 - 2 = 30

If you run this on a platform where unsigned int is not 32-bit (or unsigned short not 16-bit), the one: numbers will change accordingly, but the zero: values will still be 1 for 4 (since the MSB is still 0).