/dpt/ - Daily Programming Thread

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

Attached: 1558828626337.jpg (480x639, 32K)

Other urls found in this thread:

warosu.org/sci/thread/10708201#p10712026
warosu.org/sci/thread/10708724#p10712551
en.cppreference.com/w/cpp/types/is_constant_evaluated
twitter.com/SFWRedditImages

C# is the best language to write enterprise software in

Prove me wrong

Second for 6G.

5G is harmful. Thousands of studies over decades. Peer reviewed, etc.

Links to the archive, some good information.
Start of my own post chain.
warosu.org/sci/thread/10708201#p10712026
And an index in one post.
warosu.org/sci/thread/10708724#p10712551

Attached: Adey_qEEG.jpg (793x638, 217K)

C# is Java

Attached: Screen Shot 2019-05-29 at 8.37.40 PM.png (438x672, 369K)

Is it okay to do this in an interview?

Take a moment to actually think about this from the employer's perspective instead of posting a knee jerk reaction...

Q: how would you implement a list reversal algorithm?
A: I would use a built-in method because I don't think re-inventing the wheel is a good use of time

Q: what would be be faster in this case a B-tree or RB-tree?
A: I would have to check the complexity in the docs first because I don't believe in memorising facts about data structures

Q: how would you determine whether a gaussian kernel would work on this problem?
A: I would check stackoverflow

>Extraneous newline
QED

The statement proves itself wrong.

I only had to implement 1 function to make NaCl (pronounced "sahlt") work.

Have you ever used sharpcode or dotpeek? It is even worse, instead of byte code you can decompile back to source code.

Have sex

>I only had to implement 1 function to make NaCl (pronounced "sahlt") work.
tfw

Attached: random.png (254x88, 3K)

fuck programming

Attached: 109120933.jpg (900x937, 76K)

I dont know

Attached: Screen Shot 2019-05-16 at 12.32.55 PM.png (102x138, 34K)

Most were

Yes.

Are you actually this much of a retard or are you trolling?

fuck ayano

Coding interviews are the equivalent of throwing a ball to a basketball player to see if he can hold it properly.
If he would start autistically talking about how he would just google how to play I would not want him on my team.

>some weren't
user please

>decompile back to source code
... and that's a good thing

Cringe but true

And this is why you never let anyone borrow your devices, ever.

my daughter mashiro is so cute
my wife ayano is so cute

It's not when your intent is to see the generated bytecode which is more important when checking what the compiler gave you.

Holy pajeet

This.

n-dimensional toroidal matrix. Rate, hate, appreciate.

template
struct Matrix{
private:
using Next = Matrix;
Next _data[SIZE] = {Next()};

public:
constexpr static int size(){
return SIZE * Next::size();
}

Next& operator[](int i){
return _data[(i % SIZE + SIZE) % SIZE];
}

operator T*(){
return reinterpret_cast(this);
}

T* begin(){
return reinterpret_cast(this);
}

T* end(){
return begin() + size();
}
};

template
struct Matrix{
private:
T _data[SIZE] = {T()};

public:
T& operator[](int i){
return _data[(i % SIZE + SIZE) % SIZE];
}

constexpr static int size(){
return SIZE;
}
};

My daugher ayano is so cute

I have been programming for a year and still enjoy it, when does the bitterness set?

I'm too high on stimulants to program.
wat do.

>Q: how would you implement a list reversal algorithm?
>A: I would use a built-in method because I don't think re-inventing the wheel is a good use of time

The question is how would you implement the algorithm, not how would you reverse a list. This answer would tell me that you lack the ability to comprehend simple tasks.

yeah i'd totally hire you if you were an abrasive smartass who wouldnt even reverse a list

this is actually true

these people are live with their parents.

trust me hiring managers are looking for people to solve real life problems they don't care about your fizzbuzz implementation

I would like to ask for your daughter's hand in marriage, good sir

>T _data[SIZE] = {T()};
eww

My daughterwife ayano is a bitch

the first year is usually the worst, its gets better from there

soon
very soon

Sorry, she is already married to me

Hiring managers are either pink haired HR roasties, who just want to see if you say the same things that's on their paper

that's the right way to initialize when using a templated type fuckboi

so java but made unportable

Attached: 1st_percentile.jpg (200x202, 11K)

t. never tried to hire anyone

the amount of people who lie about everything in interviews is unsettling.
if you don’t screen people with basic skill tests you are 99% sure to end up with employees who don’t know how to program. not “program but slowly or badly”, actually unable to produce code at all

Being able to follow instructions is a "real life problem" that you're demonstrably failing at.

Are you telling me that if I extend a class I have to reimplement all its methods?
class MyList extends List {
List list = new ArrayList();

public void add() {
list.add()
}
public void set() {
list.set()
}
public void remove() {
list.remove()
}

etc.

}

>our end users are too retarded to pick download the installer for the right OS, let's just put a spyware VM under every program

No, only if you're implementing a pure interface. Extending a class literally allows you to add more members to an existing class.

Normalfags are fucking psychopaths, I don't even know how they do it
I could never lie or emotionally manipulate others with a straight face, and they do it a hundred times every day

>Autism
You can't think outside the box can you? Typical of a code monkey to interpret the question literally without thinking of alternatives. I was a terrible programmer and got a job as a consultant simply by talking my way out of answering difficult questions.

let's settle this for once, what's better for enterprise software, .net or java?

uhh no?
why would you even do what you're doing now

no they're just desperate for a job

God she's so cute. What language does she use?

C++

But if I want the methods available I have to implement them? the superclass doesn't know that I have a variable called "list" inside my class, so it can't perform its methods. I don't see the point in extending List...

are you retarded

Japanese.

Dude she is like 8 wtf

Maybe I'm not explaining this well. If I create a class which extends List, I have override the methods add() and size() (compiler says this). This is fine, but then let's say I want to remove an item from the list, I also have to implement remove(). Etc. etc. Why don't I just have a list instance variable in my class and forget the whole inheritance thing? So I could just do myclass.list.add()?

8 year old children are usually very cute, what's the issue?

first of all you don't extend list you implement it
secondly if you're just going to use an arraylist then extend arraylist instead

and?
also 8 looks like 2 holes next to each other. perfect representation for where I'm about to stick my cock

Is that too young to be programming?

>why don't I just have a list instance variable in my class and forget the whole inheritance thing?
you can and you probably should by the sound of it
you extend a list if you want to make a new type of list
if you want to make another object which incidentially contains a list, just use a list variable
favour composition over inheritance

What is a good rule of thumb for manually adding the "inline" keyword?

The inline keyword is not an optimisation, it affects program semantics. You use it when you need to.

Make literally everything inline and double check that the compiler is actually doing it.

Don't bother, unless you are making some header-only library

is this a cargo cult meme or is it actually true

The point of the inline keyword is to relax the one-definition rule. Any optimisation opportunities that follow are secondary.

It's true. The compiler will mostly ignore your inline directives for actual code inlining. The compiler will do it itself where it sees fit.

I wish C++ standard mandated anything that could be constexpr, automatically was. And made constexpr code able to call non-constexpr functions, like strlen etc.

Just common sense shit. Non-constexpr should fall under things that much be labeled volatile.

Nah, I wrote
10 PRINT "HELLO"
20 GOTO 10
30 END
about at taht age.

Visual snow.

Attached: VTS_04_008.VOB_snapshot_06.20_[2013.11.16_12.09.26]_AR.png (853x480, 438K)

When you want the function to be visible to the compiler in each translation unit at compile time. It allows multiple definitions of the function to exist as long as they are all inline and in different compilation units. Its a necessary precondition for the compiler to inline a function, but not a requirement to do so.
Constexpr functions and methods fully defined in the definition of a class are implicitly inline.

Its much better to just make everything constexpr. Although both approaches are usually bad ideas.

reminds me of metal gear solid 1

I never played the Metal Gear games.

Its not so easy because it would require the compiler to attempt to evaluate every function call that could be constexpr at compile time, which would make your compile times explode.
The standard doesn’t force constexpr functions to be evaluated at compile time as is because of that I assume.

>And made constexpr code able to call non-constexpr functions, like strlen etc.
It can so long as the code path calling those functions is never required to be invoked at compile time. Same with exceptions and asserts.

I'm stuck having to duplicate functions because one can be worked out at compile time, the other cannot.

Another obnoxious thing is the lack of dynamic allocation. eg, I want to, at compile, make a static array of null terminated strings in sequence. Then also make a static array of the offset of each element by its first letter or whatever else, for a high performance lookup table. This cannot be done in an easily maintainable way. It would need to be generated at runtime, for no real reason.

>I'm stuck having to duplicate functions because one can be worked out at compile time, the other cannot.
C++20 solves this with std::is_constant_evaluated
en.cppreference.com/w/cpp/types/is_constant_evaluated
It's available in GCC 9 right now.

C++20 solves both of these problems to a limited extent.

Hm, looking into it now. Thanks.

Dynamic allocation doesn’t make sense at compile time, because the address space being used is the compilers and not your program’s. The final table would be part of the initialized data in your program by necessity.
I don’t see why you couldn’t do your lookup table at compile time however, i’ve done it. It might just require some template shenanigans.

>Dynamic allocation doesn’t make sense at compile time
Yes, it does, and C++20 is even getting constexpr new/delete.

>Dynamic allocation doesn’t make sense at compile time, because the address space being used is the compilers and not your program’s.
There are two ways to solve this problem
#1 just don't leak dynamic storage from the compile time environment to the static one
#2 promote compile-time dynamic storage to static storage

>Yes, it does, and C++20 is even getting constexpr new/delete.
Why the fuck does C++ need new features? It should consolidate the ones it has make things more consistent rather than fucking adding a bijillion more obscure language features.

>constexpr retards at it again

this.

C++ really needs static reflection and metaclasses. No slowing down until those are in.
And slowing down is for retards anyway.

>compile time memory leaks
For what purpose?

how long until enterprise scale programs are compiled down to one line of assembly?

This is consolidation. All the constexpr improvements since C++11 are about unifying compile time and runtime programming.

How long until c++ adopts sane defaults and we can escape keyword soup (and become rust)?

Just don't write shit code, retard. C++ shouldn't hold your hand like a fucking child. C++ should just simply give you the tools, and make it easy to use efficiently and correctly.
Go fucking use Rust or Go.

Hopefully as soon as possible. The more we can easily do at compile time, the better.
Metaclasses is a great feature that will make things a _lot_ nicer.

>rust is not keyword soup
const fn () -> let: mut ref 'a = foo::(move||{});

but why would you need compile time dynamic allocation when everything should be known at compile time? It seems pointless.

Rust is symbol soup

soon we won't even need programs because they'll be entirely constant and you can just ship a data file with the result instead of the executable

Dynamic allocation is one of the things they're adding though.

I think looking at the history of constexpr makes the reason it's shit now perfectly clear. The standards committee doesn't have any respect for the idea of writing compile time programs. They started out with the single return rule. It serves nobody. Not even the compiler. It's there as an arbitrary restriction to limit programmer 'abuse'.

So it'll always be a sucky feature. They're not going all the way and allowing syscalls even thought they've turned around. And their 'new/delete' isn't really that. It's a compile time specific idea of the two features which has silly caveats to just marginally push what's comfortably written in a constexpr context.

I hate when people express C++ disabilities as generally hard problems.