/c/

...

c

c

c

c++

what the fuck

My cool language compiles to it
I use it at work and nobody knows

blien!!!!! BLIEN!!!!!!!!!

Absolutely disgusting

What do you think user meant by this?

C is the best language for building the bedrock of efficient, portable libraries. You can wrap it more safely and at a higher level from there.

a[i] == i[a] == *(a+i)

c

J

He's probably retarded.

Friendly reminder that sizeof is not a built-in function, it's an operator.
Writing sizeof(type) returns the size of the type contained in the cast operator, as if you had written sizeof (type).
This is why sizeof ptr works the way it does.

Deprecated, not self hosted and dying.

>Deprecated
t. brainlet

>t. brainlet
I know.

c will never be deprecated

C;s a terrible language, and it's a shame there's no serious effort to replace it.

Friendly C reminders:
char* s = "hello";
constructs a read-only string in the data section, while
char s[] = "hello";
constructs a writeable string on the stack with 6 elements (includes null byte).

const can be placed before or after the type name. The following are the same:
const int*
int const*

Use size_t when specifying array indices. Stay away from types like "unsigned", or "long long". Instead use and types with specific numbers of bits, like "uint32_t" or "int64_t".

Adding to a void pointer doesn't multiply by an offset, but adding to a non-void, non-char pointer multiplies by an offset
((void*)p) + 3 = ((size_t)p) + 3
((int*)p) + 3 = ((size_t)p) + 12

char is usually signed. You shouldn't use char to index into an array, because you might end up with negative indices for non-ascii characters.

Great advice user! Bump for thread.

using unsigned as an integral type is perfectly acceptable.

If your individual heap arrays are larger than 4294967296 bytes (4.3GB), reconsider your design decisions.

size_t communicates intent better than unsigned

how... exactly?
You're wasting 32 bits for no good reason.
There's absolutely no reason why you should have any single array be gigabytes in length.

But then again, communicating intent is an uphill battle in C. Better to just write big comments above every file explaining wtf is going on

check out this cool kind of generic quicksort
it really made me think because usually I use templates and iterator traits for this

#include

typedef int (*compare_t)(const void *, const void *);

static void memswap(void *a, void *b, size_t size)
{
if (a != b) {
char buffer[size];
memcpy(buffer, a, size);
memcpy(a, b, size);
memcpy(b, buffer, size);
}
}

void skeeto_qsort(void *base, size_t nmemb, size_t size, compare_t compare)
{
if (nmemb < 2) return;
char *pivot = base;
char *end = pivot + size * (nmemb - 1);
for (char *p = pivot + size; p

Bump

>void*
Desist