[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
▼ Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: IMG_8077.png (944 KB, 960x720)
944 KB PNG
Name one thing your fancy high-level language can do that C cannot.
>>
>>110400197
Employ pajeets
>>
Doing simple things without 200 lines of code.
>>
C:
static vec2 vec2_get (void) {
return (vec2){1,2};
}

A language that isn't shit:
vec2 get () {
return {1,2};
}
>>
>>110400197
You use high level languages to speed up dev when performance doesn't matter, not for capabilities.
>>
legible matrix math
>>
>>110400197
run the exact same binaries on different platforms
>>
>>110400197
>can do that C cannot
Aren't they all Turing complete? They all can do whatever the fuck you want them to.
>>
>>110400197
enforce memory safety at compile time
>>
>>110400197
Automatic free of heap memory that's no-longer referenced (variables pointing to it dropped out of scope, for example)
>>
>>110400197
Nice error handling, mataprogramming, homoiconocity.
>>
>>110400201
kek
>>
>>110400197
C is a high level language though. I know you mean dogshit with runtimes and other useless crap but let's not destroy terms.
>>
>>110400197
RAII
>>
>>110400197
Name one thing C can do that Assembler cannot.
>>
>>110400219
#include <stdio.h>
#if defined(__clang__)
#define VEC(N) __attribute__((ext_vector_type(N)))
#else
#define VEC(N) __attribute__((vector_size((N) * sizeof(float))))
#endif

typedef float vec2 VEC(2);

#if defined(__clang__)
typedef float vec3 VEC(3);
#else
typedef float vec3 VEC(4);
#endif

typedef float vec4 VEC(4);
typedef float vec8 VEC(8);

int main(void)
{
vec2 a = {1, 2};
vec2 b = {3, 4};
vec2 c = a + b;

vec3 x = {1, 2, 3};
vec3 y = {4, 5, 6};
vec3 z = x * y;

printf("%f %f\n", c[0], c[1]);
printf("%f %f %f\n", z[0], z[1], z[2]);
#if defined(__clang__)
printf("a.x = %f\n", a.x);
#endif
}
>>
>>110400411
typedef float mat2 __attribute__((matrix_type(2, 2)));
typedef float mat3 __attribute__((matrix_type(3, 3)));
typedef float mat4 __attribute__((matrix_type(4, 4)));

mat4 multiply(mat4 a, mat4 b) {
return a * b;
}


clang -std=c11 -O2 -fenable-matrix main.c -o main
>>
>>110402089
typedef
>>
>>110400197
be comfy to use
>>
>>110400197
Monads
>>
>>110400197
Save time
>>
>>110402003
"high" and "low" level are not absolute definitions, they depend on what you're comparing them with
C is high level compared to machine code or assembly but low level compared to something like Java



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.