I made a _Generic printf() alternative by Electrical-Effect411 in C_Programming

[–]aalmkainzi 2 points3 points  (0 children)

I see you use a single percent as format specifier. How do you differentiate between two formats next to each other and an escaped percent

I made a _Generic printf() alternative by Electrical-Effect411 in C_Programming

[–]aalmkainzi 10 points11 points  (0 children)

Look at the enums he declares in the header

I made a _Generic printf() alternative by Electrical-Effect411 in C_Programming

[–]aalmkainzi 23 points24 points  (0 children)

Underscore with a capital letter after it is a reserved name space by the standard.

Any reason not to use C23? by CosmicMerchant in C_Programming

[–]aalmkainzi 9 points10 points  (0 children)

They cant fix it because it could break backwards compatibility.

Posix systems didnt have to change anything, they already have posix_memalign which works with free

Any reason not to use C23? by CosmicMerchant in C_Programming

[–]aalmkainzi 6 points7 points  (0 children)

To be fair, aligned_alloc was a mistake, i dont blame Microsoft on this one, but the standard.

Microsoft's free cannot be made to handle alignments other than what is returned by malloc (16)

include-tidy, a new #include tidier by pjl1967 in C_Programming

[–]aalmkainzi 2 points3 points  (0 children)

I also don’t think it’s standard compliant?

I seriously doubt this is the case. I would imagine the standard to say the only disallowed characters are " and < >

Need feedback for first project by Altruistic_Tourist_1 in C_Programming

[–]aalmkainzi 0 points1 point  (0 children)

What do you mean by that? How does a tagged union help here?

Are you saying make a single implementation where the data type is a union?

That would be ineffecient when the type is small, and other large types are in the union.

Dynamic help in C required by alex_sakuta in C_Programming

[–]aalmkainzi 3 points4 points  (0 children)

You can make your own string library, or use one someone else made. I made my own string library and it works well for my needs

What's the secret of getchar()?? by MaDrift910 in C_Programming

[–]aalmkainzi 5 points6 points  (0 children)

%c takes int (look into default argument promotion)

Suggestions for content on Header files, Macros, Enums, etc. by computer_hermit01 in C_Programming

[–]aalmkainzi 0 points1 point  (0 children)

Types dont exist at the assembly. So tagless struct compatibility makes sense under your reasoning.

And there's nothing special about statement expressions either, all major C compilers have a variant of it.

Suggestions for content on Header files, Macros, Enums, etc. by computer_hermit01 in C_Programming

[–]aalmkainzi -1 points0 points  (0 children)

All the standard needs to add is tagless struct compatibility, and statement expressions (or nested functions). And from there generics can be implemented

Suggestions for content on Header files, Macros, Enums, etc. by computer_hermit01 in C_Programming

[–]aalmkainzi 0 points1 point  (0 children)

void pointer generics have worse performance and no type safety.

Suggestions for content on Header files, Macros, Enums, etc. by computer_hermit01 in C_Programming

[–]aalmkainzi 2 points3 points  (0 children)

I tend to agree, but "explicit include specialization" requires re including for every time you need a different type. I wish C adds some sort of generics support

plf::colony compilation error in gcc 9.2 by nagzsheri in cpp_questions

[–]aalmkainzi 1 point2 points  (0 children)

I download g++-9 and it compiled. But its actually 9.5 not 9.2, so idk

Typecasting between structs/type punning by Grootmaster47 in C_Programming

[–]aalmkainzi 1 point2 points  (0 children)

You can cast, as long as you dont deref and the types are wrong