/dpt/ - Daily Programming Thread:

What are you working on, Sup Forums?
cia niggers wanna know.
Previous thread:

Other urls found in this thread:

gitlab.com/xonotic
youtube.com/watch?v=ORh6NfQRDxg)
github.com/xonotic/xonotic
gitlab.com/xonotic/xonotic-data.pk3dir/blob/master/qcsrc/common/triggers/teleporters.qc
youtu.be/zpQRePtEpRw?t=1m8s
twitter.com/NSFWRedditGif

Idris is the only practical language today

Reposting because I'm still clueless:
I wish to learn about gitlab.com/xonotic
It's a very impressive game in some ways and it's completely open source, so that's nice.

But I don't see where I should start learning about this project. How do you approach something like this? I don't have any specific goals aside from figuring out how the warpzones (youtube.com/watch?v=ORh6NfQRDxg) work so smoothly (this video isn't a good representation since it's recorded from a demo perspective, ingame it's completely free of artefacts). But I'd also like to get a general gist of the engine.

Should I run some graphing tools on it? What do I do?

install gentoo

What does this OP image have to do with anime or programming?

>t gitlab.com/xonotic
doesn't even include a description of the project

how am i supposed to know what is this

>how am i supposed to know what is this
It's an open source game written mostly in C.
github.com/xonotic/xonotic is perhaps a little better.
I don't know where to start. If anyone could share their general approach for teaching themselves about large projects that'd be nice.

Ask the dev if there's anything to do.

>saving two times the same image

I'm just looking to learn, not to contribute, yet anyway.

after i finish reading K&R i'm going to include it on my resume as one of the languages i'm fluent in, so that'll make 2 along with python. i want an OO language to include in there as well to round things out. i already have passing knowledge of java and C++. what OO language should i pick to learn in depth?

if you want to be employable? Java. Save C++ until you have a strong understanding of C and Java.

html

Does eating hot peppers enhance programming ability?

That's the only copy, actually

You can learn by contributing.
Stop being autistic and ask if they need any help.

only if they're red and with chili

not exactly employable per se at the moment, i'm looking to go to grad school for information security. but i would want a well paying internship over the summer to bridge the gap both on the resume and to make ends meet

I know Java, C, and some Python.

Is it worth it to start tackling some C++, or am I wasting my time?

not really

Why not just raw peppers without any impurities added

No, I have (1)

It's a good idea. Just remember that C++ is its own beast, and shouldn't be written as C with classes or Java without GC.

>i know c
no you don't

C with RAII/templates/exceptions is the best way to write C++

>ask any questions about Java
>is ignored
Ok

c's not a big language. it was made with minimalism in mind. i don't know why people make it out to be so difficult

>exceptions

You know nothing about me.

Exceptions make me uncomfortable, but they're essentially necessary once you introduce RAII and constructors.

there's only one think i know about you: you don't know C.

what have you made in c?
fizz buzz?

nice troll m8!

- Compiler with three levels of optimization (C -> ASM)
- Transpiler (JavaScript -> C)

you?

i've not made a large application in C because no one does except when Sup Forums makes another project which will never be finished. but i know the language. not even the guy you were initially accusing of not knowing C btw, i just interjected because you seem like a dick who thinks C is super hardcore

>think

exactly, you can think whatever you want

thanks

do you have any resources you'd recommend for stuff like that? i took my operating systems class with my mentor who's a bit disdainful of low level stuff (along with all 12 faculty of the csci curriculum at my uni) and he's ALSO teaching my high performance computing class this semester. which i was pumped up for since i wanted to go ham into assembly and now i'm certain he'll neuter it. it's like they're trying to actively undermine low level at this place. i've never built an assembly program or a compiler

...

this kind of warp zone is simple and done at the map level (it's just a transparent teleport). if you want true portals, have a look at prey which did it first and is open source.

about xonotic, it seems most of the game has been coded in a custom programming language for a virtual machine. teleporters logic is here
gitlab.com/xonotic/xonotic-data.pk3dir/blob/master/qcsrc/common/triggers/teleporters.qc

think i'm going to learn C++ instead of java because i want to go into security, not app development. thoughts on this? i also kind of want to learn ruby since people who use it make it seem fun but if i follow that logic i have no reason to

That works.

writing a program that can teach me how to love

c++ is a horrible language
it's made more horrible by the fact that horrible programmers use it
stay horrible

have fun doing that

Why exactly does Sup Forums think "knowing" C is some sort of impossible feat?

$ man love
$ No manual entry for love

"Knowing" C isn't all that difficult. Doing all those clusterfucky things people who have merged with the machine do with void pointers is.

is this program valid?
struct {
int foo, bar;
} baz;

int *example()
{
return &baz.foo;
}

...

this place is full of kids, what did you expect?

I didn't think C was hard until I took an OS class where it took me ours to debug my code and I felt like an idiot. It probably helped me as a programmer though.

It compiles, if that's what you mean by valid.

Fuck I meant to say hours.

does he leave home?

Not him but I would say the &baz would give you the memory location of the struct baz but I don't think .foo would work on that because it is acting on a pointer to a struct and not a struct.

I'm pretty sure . binds more strongly than & because -> binds more strongly than *

And why would you do "clustryfucky things"?

I work with C, maintaining and developing a program with roughly a million LOC (level 1 and 2 systems in the process industry). I came straight from uni and had no troubles getting into it.

Who is the ultimate meme slob and why is it C++

Are you saying . has greater precedence over &?

What is the memory location of the struct baz?

Yes

>What are you working on, Sup Forums?
still project euler.
Problem 39 was easy.
We are getting close to >50 where problems finally get above 5% dificulty rating

#include
#include

int solutions[1000] = { 0 };

int main()
{
int a, b, c = 2, p;

for(a = 1; a < 1000; a++) {
for(b = 1; b < 1000; b++) {
for(c = 2; c 1000 ) {
break;
}
p = a + b + c;
if(sqrt(a*a + b*b) == c) {
solutions[p-1]++;
}
}
}
}

int max = 0;
int index = 0;
for(int i=0; i < 1000; i++) {
if(solutions[i] > max) {
max = solutions[i];
index = i+1;
}
}

printf("val: %d, solutions: %d\n", index, max);

return 0;
}

Ah okay, so it would work fine then.

. has higher precedence than * so it'd follow for it to have higher precedence than &

If I have a typedef
typedef float vec3[3];

And I put it in a struct
typedef struct {
vec3 n;
vec3 p;
} s;


Are n and p pointers or are they arrays?

Test it with sizeof and find out.

>this kind of warp zone is simple and done at the map level (it's just a transparent teleport). if you want true portals, have a look at prey which did it first and is open source.
This is not just teleporters.
See the video I posted. There's teleporters and warpzones in xonotic. Warpzones are similar to prey except there's none of the weird changing of what's actually up/down or scale (I dunno, maybe I was just fooled).
What are you saying is wrong with these compared to preys teleporters?

sqlite3_exec(*,"SELECT * FROM TABLE",*,*,*);

Is it wrong that I think using literal human-readable strings to communicate with my database is just the teensiest little bit retarded?

Welp, they're arrays.
0 typedef struct {
1 vec3 n; //normal of rect
2 vec3 v0;
3 vec3 u; //v1 - v0
4 vec3 v; //v2 - v0
5 float negunorm; //-(u dot u)
6 float negvnorm; //-(v dot v)
7 float k; //(u dot v)^2 - (v dot v)(u dot u)
8 } model_raytest_rect;

Has a sizeof of 60. If they were pointers it would be 44.

PS C:\Users\justin\c-programs> cat .\struct.c
#include

struct tuple { int foo, bar; } baz;

int *example(){
return &baz.foo;
}

void main(){
baz.foo = 9;
baz.bar = 18;
int *r = example();
printf("%d\n", *r);
return;
}
PS C:\Users\justin\c-programs> gcc struct.c -o struct
PS C:\Users\justin\c-programs> ./struct
9

were you just asking people to do your homework? i thought this was supposed to be some type of trick question

use an ORM then

Er, 48? I think 48 actually due to word alignment.

>were you just asking people to do your homework?
No I didn't post the original I was just trying to test my own knowledge of C by giving my thoughts without looking anything up.

If they were pointers, where would the memory be?

It would be I have to call malloc.

someone please respond

Aligned to what? Everything in your struct is already (double) word aligned.

48=4*12 (3 floats 4 bytes each).


mong

Knowing C as a language isn't hard.

Doing something with C requires a good understanding of your operating system's syscall interface and various memory and multiprogramming features that it has, the libc that comes with it and a basic understanding of the compiler-generated code which can be abstracted on a slightly higher level to assembly code.

It takes a very long time and a lot of effort to understand these enough to become "good" enough in C to really say that you know C, if by knowing a language you mean being able to manipulate it efficiently to do anything you have in mind. By that definition, while knowing python takes a few weeks at most, "knowing" C can take years and a few weeks for every operating system you "know" it on.

I'm working on a router firmware project in C because I want to contribute to openwrt and it is slowly turning into a nightmare.

If the typedef was an alias for float*, it would have to be 48 bytes because pointers are quad word aligned.

4 typedef struct {
3 float * n; //normal of rect
2 float * v0;
float * u; //v1 - v0
float * v; //v2 - v0
float negunorm; //-(u dot u)
float negvnorm; //-(v dot v)
float k; //(u dot v)^2 - (v dot v)(u dot u)
} model_raytest_rect;

Try sizeofing it yourself.

So basically saying that you know C just shows that you don't understand C.

...

rate my kode cia niggers

:|

edgy

void s_switch_bool(bool *b){ *b = (*b) ? false : true; }

int main(void)
{
bool b = true;
printf("BOOL is %s\n", b ? "TRUE" : "FALSE");
s_switch_bool(&b);
printf("BOOL is %s\n", b ? "TRUE" : "FALSE");
return 0;
}


:^)

What's so edgy about helping the high priest?

Trying to compile a C program and add maria-db connector to it, but the mysql headers typedef uint64 which the program itself has already defined, so there's a typedef conflict. What are my options?

>/root

It's a server nigger.

i saw the video and saw no difference with a teleport. the player is tricked by the map having both end as the same. (see pic). this is a old trick that was already used in pac-man and would have produced the same effect if you played in the first person.

>What are you saying is wrong with these compared to preys teleporters?

youtu.be/zpQRePtEpRw?t=1m8s

prey portals were truly amazing in their time.

...

*b = !*b;

>because pointers are quad word aligned.
Nope.

But if you are on x64 the pointer will naturally be 64 bits. This has nothing to do with alignment.

Fix both the mysql headers and the program to use c11/posix typedefs.

Thats not edgy enough
Useless code is good code :^)

so? you still have a home folder for the user you're supposed to run it as (unless your idea of running scrappers is running them as root lol) and if you have any storage attached to the server it shouldn't be mounted as /root either

>Trying to actually use Rust for the first time
>The .unwrap() meme is real

He's either mentally ill or underage