Download Pelles C here: http://www.pellesc.se
.386
.model flat,stdcall
option casemap:none
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
VaFunc PROTO C :DWORD,:VARARG
.data
f db 'Sum = %u',0
.data?
retaddr dd ?
i dd ?
.code
start:
push 7
push 6
push 5
push 3
call VaFunc
invoke printf,ADDR f,eax
invoke ExitProcess,0
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
VaFunc PROC C x:DWORD,y:VARARG
pop retaddr
pop edx
xor eax,eax
@@:
pop ecx
add eax,ecx
inc i
cmp edx,i
jne @b
push retaddr
retn
VaFunc ENDP
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
END start
many of us end up there every once in a while....typedef struct { float m[16]; } Mat4;
Mat4 broken(void) {
Mat4 s;
memset(&s, 0, sizeof(s)); // set the block
s.m[0] = 1.0f; // explicit
return s;
}
// Caller:
Mat4 result;
memset(&result, 0xCC, sizeof(result)); // fill with known garbage
result = broken();
/* Expected per C standard: result.m[1] == 0.0f */
/* Observed: result.m[1] == -1.07374e+08 */
/* (the 0xCC garbage — the copy never wrote that slot) */QuoteImplementation of CommandLineToArgv for Win32
(ANSI and alternative Unicode versions)
QuoteCommandLineToArgvA
Collection of functions implement CommandLineToArgvA, the ANSI version of CommandLineToArgvW in windows API
Quote from: ander_cc on March 15, 2026, 11:30:22 AM#include <stdio.h>gcc 11.4 -std=c23
#include <stdbit.h>
int main() {
unsigned short a1 = 4;
unsigned int a2 = 4;
printf("a1 one:%u a1 zero:%u\n", stdc_first_leading_one(a1), stdc_first_leading_zero(a1));
printf("a2 one:%u a2 zero:%u\n", stdc_first_leading_one(a2), stdc_first_leading_zero(a2));
return 0;
}
a1 one:14 a1 zero:1
a2 one:30 a2 zero:1
-----
pelles c 13.01
a1 one:3 a1 zero:16
a2 one:3 a2 zero:32
-----
WHY? and which is right?
Page created in 0.049 seconds with 15 queries.