/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

youtube.com/watch?v=tb-t4j9wt7E
github.com/zmulsion/multiuser-chat
twitter.com/SFWRedditImages

You've got things the other way around here. It's not conceptually OOP at all. It's similar to how C++ compiles method calls (which are not particularly OOP either if they're not virtual and don't use encapsulation), but in no way, shape or form does that make that code object-oriented.

Can ANSI C using be justified nowadays?

Yes.

How?

Uh, the X kinda seems to be 7 repeating values
The Y seems to be growing and then shrinking again in a non-linear manner

The function is 10x faster without Math.Pow

Function call overhead isn't the bottleneck

I'm already caching the results but I need to make the initial calculation faster
>also consider that x^y = b^(y*logb(x))
I have no idea how to write that in C#
Accuracy shouldn't be an issue though
The final result is stored as byte

C ANSI is the only relevant C.

>tfw using experimental C++17 features

No. C was deprecated by Lisp back in the 50's.

Never mind the fact that both GCC and Clang default to C11.

I believe you mean GCC defaults to GNU11.

>c++ library that does not export C api
Why is it even legal to distribute such shit?

I don't know what's going on in your first block of code, but yes, that's how it works in C++. A member function has a hidden parameter called "this" that it uses to know what object it's working on.

So

class A
{
public:

int x;
int y;

int total()
{
return x+y;
}

};

A a;
a.total();


Would look like this in C, at least I think, I don't really know C.

struct A
{
int x;
int y;
};

int total(A* a)
{
return a->x + a->y;
}

A a;
total(&a);

I'm trying to figure out how to modify XMP tags. I can turn the XML into something I can more easily work with (XEXPR's) and I can search through and find a tag, but I haven't the foggiest idea on how to replace parts of the XEXPR.

I don't give a shit. I know how to fix that and use the only C standard.

EVA would have been decent if shinji wasn't a fag that cried all the time

I meant having precalculated values for log(x) in an array, maybe like 100, and some function that takes your x, lets say 0.4, and maps it to an index into that array, e.g. 40. then you get the value of log(0.4) from the array, multiply it by y and get a value p. now you have a second array with precalculated values for 2^p, and again get your value from there without the need for calculating anything. These arrays would either be filled during initialization of your program or better yet just in the sourcecode. I have used something similar for sin and cos and just wrote a shell script to print an array initialization that I could just copypaste into my code.

a.total() and total(&a) are very different.

I only watch anime starring real men who work out for fun and kill/rape people who disrespect them.

I'm a C programmer.

Does anyone know any resources on motion compensation and estimation?

>I'm a C programmer
No, you're a faggot. I only read gender bender manga with traps and identity swap.

I'm a Haskell programmer.

Well, theres the v table and various C++ only features like static members. But that's still basically how methods work.

show me your shittiest C project

you can link a github repo if you want

>traps
>haskell
Boys can't be Girls.

Wait 6 months and I'll link you the final project for my C class.

if you would create an app for android devices wich sdk / version would you target?

im a .net guy , so tipically for me its either .net 4.6 or for uwp apps just windows 10.12XX build and it just werks in all devices, now im in charge of porting something to android and its giving a headache all the java skds and android versions.

rate the usart code from my first project
#include "general.c"
inline void usartInit( unsigned int ubbr)
{
UBRRH = (unsigned char)(ubbr);
UBRRL = (unsigned char)ubbr;
UCSRB = (1

you are confusing how methods are implemented with how they work software engineering wise. what you described here is nothing else than a data type.

so very beginner git question I've made a folder wrote all my code and now made the repo, I plan on git cloning the repo then dragging all my files from folder a to folder b is there a better way? if so what do I do or what should I look into?

lol just realized that header's totally unnecessary

Trying to figure out how this works. It's a 2D ragdoll that balances itself standing up only using joint torques. I think I've almost got it figured out but I don't want to start implementing it until I'm sure.

youtube.com/watch?v=tb-t4j9wt7E

It uses inverse kinematics to place the feet so they are equidistant from the center of mass which allows the body to balance over them. That's the basics but I'm trying to fill in the blanks.

I think when calculating the X positions to move the feet to it will always try to keep them as close together as possible, or pretty close some arbitrary number. (standing up straight) But there are joint limits so when it starts falling over, to maintain equal distance from the center of mass, one leg will cross over the other and possibly be forced to take a larger step if the other leg can't bend that far. Pretty sure that's all you have to do for the X positions.

The Y positions I'm not so sure. Pretty you simply extend the leg as far down in the Y direction while staying within the range of motion. Not entirely sure about that though. Anyone got any input?

That's what the guy was asking about. How they're implemented.

he didn't ask anything.

I'm trying to compile and run C on Notepad++ using MinGW. I think I've managed to compile it, but it won't run anything i.e. it won't display "hello world" in console.
What do I need to do to get it to run the program?

you need to call the executable generated by the compiler, by default it's named a.out (maybe something different on windows, just check with "dir" if there's a file that wasn't there before), so to run it just type ./a.out

Install emacs first.

JUST

sign in boi

I suppose I'll ask on the Racket mailing list. Hopefully the PhD's and university professors that lurk there can give me some pointers.

>What are you working on, Sup Forums?

Trying to implement a lock-free stack in C++. Hazard pointers are a bitch...

I'm trying to make a little menu game using a python menu library called urwid.

But as i'm programming i'm starting to write everything extremely streamlined, in a lack of better words.

THe first thing i do is jump into a series of functions that creates the main menu. From those functions, depending on what i chose. I jump into a different set of functions that creates a menu. Depending on what i chose there i jump into another function that creates another function. etc, etc.

I'm pretty sure that what i'm doing is going to fuck everything up as i go along. Functions calling new functions calling new functions is going to end up crashing. right?

Can someone give me an idea of how i should do this the smartest way?

Pic related is what i'm playing with looks like.

>60 lines to make two buttons
jesus christ either use an engine or create it yourself

Excuse me?

>giving up your privacy and freedom
Might as well just take down the curtains and fap in front of the window for everyone to see.

github.com/zmulsion/multiuser-chat

it's not a terrible mess, but it is broken

ok it might be a little bit of a mess

maximum autism

Does anyone know or have a program written in C relatively big around 500 lines that i can test?

basically i'm doing software fault injection and mine entire programs with bugs and then do data analysis about that , code coverage, etc..

thanks

Go to Github and search for projects by language.

RMGUI will always suck. For the state machine, have the states be functions, but don't call the next state directly, return it. This will prevent stack overflow, and make it easy to implement delimited continuations for interesting control flow.

fuck cmake

i have a headache now

Remember to pick a project by an indian.

Sounds like mansplaining to me.

What's your favorite language?

that's what i've been doing but i need programs that read from input like
./program < big_input.txt > output.txt


and it's hard to find. i've to do test-suites for them so a program like that would be better

Anyone done CUDA coding?

I'm looking to learn a bit of it, but only have an 8600M GT to work with for now. Is CUDA 1.1 too old to be of any use in learning the basics?

search for SPOJ or Project Euler on github

>tfw my waifu is more than two times older than me

What are some functions in java that you usually need to provide, but never write a function call for?

mane

..........

Can I program a boyfriend who won't get upset over trivial, pointless shit?

you spelled girlfriend wrong

No, I didn't.

Of course they can. What do you think MonadTrans is really used for?

Pls answer.

oh my bad i dont have my contacts in

AI Gfs who don't get upset over trivial pointless shit while also being realistic enough are only about 10 years off. unless you are experienced in C++ then you need not contribute all you have to do is wait, soon we will have perfected AI waifus

You don't understand, I don't want a waifu, I want a husbando.

>C++
>AI

one that won't bitch and only gives you sex?

And that will go out and work and give me his salary.

I want to rape this bitch

Hmm that last part is pretty tough. If communism kicks in fully then you can live on government welfare and get some random black dude to fuck then ignore you all day, but I predict their will be a population collapse before the automation revolution has time to cause wide scale unemployment.

So it's impossible. Sorry.

So if I have separate scripts that get started or ignored when you run config.py would it make sense to put them in a folder called modules?

Daily reminder that C++ is the only language that you will ever need to learn in your life, the rest is pure meme trash.

what's the difference between java and java EE?

Why wouldn't you use a language with an advanced type system?

and javascript too :3

Java is taught to high schoolers
Java EE is taught to pajEEts

At this point no type system in a usable programming language seems advanced to me.

Why not html too?

And COBOL

And PHP

No. Not at all.

>C++

To me, no language without an advanced type system seems usable.

are the jews behind this?

#include
#include

int main(int whatever, char **fuck_you) {
for (int i = 1; i

>inappropriate language
Don't call us, we'll call you

will a class object made inside a function only be available inside that function?

Fuck off Pajeet.

Yes

no

You can return it.

In writing a typical Java GUI, we often have to provide certain functions for which we will never, anywhere in our code, write a function call.

What are the most common examples of such functions?

CAN SOMEONE HELP WITH THIS QUESTION.

if you want the object to be global for all the functions to use it without passing it as a parameter, you need to declare it within the class scope, but outside any function

...

Wanna give me an example?

On platforms where a C11 compiler is not available, yes.

But there are not too many of those. I know Amiga is only supported by an old version of GCC (4.2 IIRC), but it should still at least support C99, which is still better than C89.

...
}else{
...


or

...
}
else{
...

what