/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: dpt2.jpg (300x300, 36K)

Other urls found in this thread:

github.com/ErisBlastar/cplusequality
gustedt.wordpress.com/2018/11/12/c2x/
twitter.com/SFWRedditGifs

Good morning, everybody.

i am working on Laravel website
so what
fuck you
php 7 is awesome and powerful
its sure as hell it will outlive many other meme bullshits that become hot for a period of time
stop bully php
r-ree

learning Julia, its C FFI seems very comfy

Gotards be like
>[feature] is harmful
>*implements worst possible version of [feature] when it becomes clear that [feature] is useful*

hopefully finish refactoring then start working on auto concurrency

it's fine. do good work, user.

what is auto concurrency? I presume not two cars at once?

nice. do you have a particular application in mind?

thanks user
im under lot pressure, i am out of job,at my parents and making this private project hoping it will become live and then i need to look for actual job again

There are plenty of reasons to criticise Go yet THIS retard is criticising it for choosing to implement generics CORRECTLY and not just glorified macros

but we already have a language
github.com/ErisBlastar/cplusequality

automatically transforming single threaded code into multi threaded

what's the best language as means to cleanse yourself of the filth that is webshit?
god, I just want a non-webshit job

c, also vhdl

It may be better to focus on what you actually want instead of what you want to avoid since there may be non-web jobs you would equally dislike.

I don't know what I want

that sounds pretty amazing

templates are the worst form of generics that are already in common use, but go generics are somehow even worse
>no polymorphic behaviour
>no monomorphic specialization either
>literally the worst of both worlds
>introduces contracts for zero fucking reason even though interfaces already exist
C++ is better, Java is better, C# is better, and those are all shitty poolangs that don't come close to real parametric polymorphism as you find in ML or Haskell.

>>no polymorphic behaviour
>>no monomorphic specialization either
how is that even possible?

If I were you, I would spend some time researching and writing about my options to figure out a goal and come up with a plan.

yeah, i'm quite excited.
considering Moore's Law and the trend of more cores it's probably going to be one of most important innovations.

Trait based generics are the best kind of generics

"traits" can be cleanly separated from generics

I really should (again).
Last time I tried that I figured it would be pointless since I'd be stuck in this for a few more years.
but now I even got my master's finished and I'm still absolutely clueless on what the actual work at different jobs is like, only got experience in one company and I hate both the technology it uses and the field it specializes in

What ungodly shit does C++ do in the regex header? I have like a 500 LoC program with a fuck ton of standard headers included and it compiles under a second, I add the regex header and it takes over 5 seconds.

>What ungodly shit does C++ do in the regex header?
Regex

Modules will fix that.

Wouldn't it be funny if those fucks made it so there's a compile time regex that actually generates the actual header text? I wouldn't put it past Bjarne and co. dictating it as per standard.

C++ modules are sadly DOA.

the only real programming language worth knowing is C++

Headers were the dumbest thing to ever exist. I'm amazed C++ hasn't gotten rid of them yet. They are not needed and just a waste of typing.

The rationale is that they're leaving it out of the semantics so implementations are free to decide which to use.
When compiling a Go generic function, the Go spec is ambiguous enough to permit it to either emit a single function, or to emit one function for each type. Because the Go language will never enter a situation where either output is required - you will never use a pointer to a generic go function, and you will never specialize a generic go function - this isn't a problem.
Personally I don't think that's so horrible, but it is somewhat amusing that the solution to "generics are hard" is to merely half-ass it and commit to no implementation.

>C++ modules are sadly DOA.
wrong

What are some project ideas for someone beginning C? I dont want to do any "coding challenges" because theyre just not interesting; its just a bunch of stuff like "reverse this string" or "add all the odd numbers in this array". ugh.

print triangle you noob

but with "runtime" generics you could just monomorphise when it's statically known?

By not letting you rely on the semantic advantages of runtime generics, the Go devs keep the door open to commit to a fully monomorphized implementation in the future. Like I said, it's very evasive.

Trying to find a job. Are fancy graphics or simple-font the best way to present a CV?
Also, how specific into your skills do you need to go?

I'm looking at other sites, I figured I'd also ask for /dpt/ insight.

Attached: 1564565600679.jpg (400x292, 33K)

▲ ▲
fuck

Not him, but I just started doing C++ and I did this with OpenGL. It's pretty fun. I didn't expect much from it, but it was a blast tinkering with shaders after.

a bytecode VM or an Nbody simulation

>Graphic development used to be a form of low-level development, requiring advanced math and computer science training.
>It is becoming more accessible with the introduction of commercial and open source frameworks and systems.
>For example, very few people today need to be able to write a shader from scratch.

Graphics has gotten even more low level. You didn't have anything like Vulkan back in the day, short of writing GPU assembly or some shit.

uhh
>Occult Programmer. C++ Bruja. Build System Trash Goblin. Crowdagger. void*. Stoner/Sludge/Doom Enthusiast. No Gods, No Masters. | | xe/xyr

Think about what you would prefer if you had to read hundreds of CVs. Something pleasant to look at... but without diminishing the accessibility of the information?

>google C++ std::trim
>no trim exists
What the fuck.

std::pair trim_pair(std::string str,std::initializer_list< char > filtered_chars ){
if(str.empty()) return std::pair(0,0);
std::array filter_table;
int lbound,ubound;

//define bit-array operations
const auto setBit = [&filter_table](int index){
int block_id = index/64; //index >> 6
int block_offset = index%64; //index&63
filter_table[block_id] |= 1> 6
int block_offset = index%64; //index&63
return filter_table[block_id]&(1 bool{
return getBit(c);
};

filter_table.fill(0);
for(char fc : filtered_chars)
set_filtered(fc,1);

lbound = 0;
while(lbound < int(str.length()) && is_filtered(str[lbound])){
lbound+=1;
}
ubound = str.length()-1;
while(ubound >-1 && is_filtered(str[ubound])){
ubound-=1;
}
return std::pair(lbound,ubound);
}

std::string trim(std::string str,std::initializer_list< char > filtered_chars ){
if(str.empty()) return "";
auto p = trim_pair(str,filtered_chars);
int lbound ,ubound;
lbound = p.first;
ubound = p.second;
return str.substr(lbound,ubound-lbound+1);
}

just use boost :)

you can just:
return {lbound, ubound};

What is the difference between scoped_lock, unique_lock and lock_guard?

lock_guard cannot be moved from while unique_lock can
scoped_lock is the same as lock_guard except it can do multiple mutices

So basically if I need a single lock and I don't care about moving then I should use a lock_guard?

How can I make some money freelancing or some shit if I'm a mediocre programmer?

you can use either lock_guard or scoped_lock and it will have the same results
scoped_lock subsumes lock_guard's functionality

Suck some truckers off.

be a great salesman

and keep working on your skills

Yeah that makes sense, I'll just use a lock_guard since I don't need the funcionality of a scoped_lock so the intention maybe is clearer for a potential reader that knows what's actually going on. Thanks a ton.

if you find a local business that needs a website or something... they won't know how to judge your skills.

you only need to be good enough to do a good job... but don't stop improving

>What are you working on, Jow Forums?
Setting up a second boot so I can mainline some sweet Arch gear into my workflow. Also why did I decide to do this

Attached: scr»ót.png (1920x1080, 60K)

Trying to get a defense contractor type job. Anyone got tips? I have an advanced degree and feel confident in my knowledge of the field but I'm not the best C programmer. If I'm not trying to get a straight programming job how much of a handicap is that?

More languages need graph data types in their standard libraries

>Th-The implementations of graphs are too different!
Then just do:
Graph g1 = new AdjacencyMatrixGraph();
Graph g2 = new AdjacencyListGraph();

Standard Libraries should not be bloat.

alright now how do you connect g1 to g2 efficiently?

You mean a union?

that's one possibility

is it good enough to have a de facto standard library everyone uses?

I'm trying to solve an exercise from Eloquent JavaScript. How retarded on scale from 1 to 10 is this?

/* Example of a list:
let list = {
value: 1,
rest: {
value: 2,
rest: {
value: 3,
rest: null
}
}
} */

// Build a list structure like the one shown above.
function arrayToList(array) {
let list = {}, restList = null;

for (let index = array.length; index != 0; index--) {
list.value = array[index - 1];
list.rest = restList;

restList = {
value: array[index - 1],
rest: restList
}
}

return list;
}

exampleArray = [1, 2, 3];
console.log(arrayToList(exampleArray));

Attached: apu.jpg (957x621, 71K)

does that even work?

It werks, at least in node.

Attached: Screenshot from 2019-08-01 17-38-04.png (1920x1080, 207K)

Seems okay. Here's your list maker achievement badge.

Attached: badge.jpg (225x225, 13K)

how does it work if list never changes? doesn't it just set the value and rest of the root node?

oh shit it's backwards
nevermind

class Person {
string name;
string title;
//literally 50 params
//...
string email;

private string[] ConvertToArray(){
ConvertToArray(this.name, this.title //literally all 50 params//
}
private string[] ConvertToArray(string name, string title //... // ) {
var params = new string[50];
params[0] = name;
// ...
params[50] = email;
}

//... Somewhere else in the code
Person MakePersonFromArray(string[] params) {
return new Person(params[0], params[1] //...// params[50]);
}
I just fucking can't. What the fuck drives people to write shit like this?

Attached: 1564383010617.jpg (966x1024, 226K)

Thanks. I though about making it recursive but still can't wrap my mind around recursion.

I don't even know JS lmfao

function arrayToList(array) {
let list = {rest: null};
array.reduce((x, y) => { x.rest = {value: y, rest: null}; return x.rest; }, list);
return list.rest;
}

>a recursive version
Have you tried to figure out what is supposed to happen on paper?

I didn't knew about the reduce method, user. I though that I should only use methods that were explained by the book.

Nah, only in my mind. Maybe I'll try to figure it later.

Python doesn't have this problem.

Python doesn't have autistic programmers?

five minutes on paper can solve things that five hours on the computer can't do

Redpill me hardcore on CUDA /dpt/.

OPENCL YOU FOOL

Ok, Opencl then senpai

Redpill me on OpenCL /dpt/

AMD was too stupid to make their own good functional equivalent to CUDA so Khrons had to step in and make OpenCL which performs worse than CUDA on NVIDIA but lets you use AMD.

run function on CPU but if you need to run the same function multiple times it might be worth to perform calculation on GPU. Moving data to GPU has overhead.
Math calculations, physic engines and such libraries likely already use opencl/cuda so you likely never need to use it directly.
If you have some special calculations and you need the performance from GPU then you need to write your custom opencl kernel but if you have to do that then you already should know what you are doing.

Has anyone read Haskell Programming from first principles? I started reading this book after SICP and the first 5 chapters are way too easy. Does it get harder?

Just write a Game of Life, it's relatively easy with SDL.

Attached: 2019-08-01-002017_1920x1080_scrot.png (1920x1080, 228K)

Doesn't matter. The important thing is to understand the GPGPU programming model. After that switching between whatever vendor specific API is trivial.

Attached: memory-hierarchy.png (535x505, 76K)

Build what Stroustrup *should* have made, whatever that might be.

Attached: p32mxlxZw91wxdq3zo3_1280.jpg (1280x853, 618K)

Is C language stale? Why aren't they adding anything to the standard?

They don't need to.

Nothing to add. C is already perfect.

i haven't read it but it's a huge book, it should get to interesting stuff eventually

can you guys recommend a list of easy/novice to intermediate programs I can try? I'm learning JS.

People who want something extra in their C make a new language.

you might have better luck in /wdg/, or just searching.
personally, I would search.

Find a good intro textbook with lots of exercises.

this is most likely better than my suggestion

to clarify: you should find a book

I have nothing to give but let me know if you need anything.

They are gustedt.wordpress.com/2018/11/12/c2x/