/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

t.me/dailyg
git.musl-libc.org/cgit/musl/tree/src/string/strtok.c
git.musl-libc.org/cgit/musl/tree/src/string/strlen.c
twitter.com/AnonBabble

Haskell is the strongest!

>Haskell shills can post all day long because they're unemployed

So, text editors in 2017

>Electron bloat
or
>80 for sublime
or
>acquire special form of autism called emacs

what do

For shell scripts, what's cleanest?
1:
[ ] && {
dosomething
dosomethingelse
}

2:
if [ ] ; then
dosomething
dosomethingelse
fi

Use vim or use one of the leaked cia sublime codes.

V I M
I
M

>Anime
Hi!
Go to hell.

thought you were DEAD until your name came up on my GitHub front page recently for some reason

Once upon a time I used vim with gdb, nevah again

that's not my github

Maybe you should configure it in a way you like then?

I'm a burger so I don't understand, user.

Cheer up, me!

>emacs
Don't even fucking joke about that. You want to be crippled at age 40?

spacemacs

Expensive shipping.

why? emacs seems to be the only sane choice these days

#include
#include
using namespace std;

class FixedPoint2 {
private:
const int m_abs_decimal_limit{32767 + 1};
const int m_abs_fraction_limit{99 + 1};

int m_decimal{0};
int m_fraction{0};
int m_sign{1};

public:
FixedPoint2() {}
FixedPoint2(const int d, const int f = 0) {
m_decimal = abs(d) % m_abs_decimal_limit;
m_fraction = abs(f) % m_abs_fraction_limit;
if (d < 0 or f < 0) {
m_sign = -1;
} // else take the default value 1
}

friend ostream& operator

V
I
MIV
I
MIV
I
MIV
I
MIV
I
VIM
I
VIM
I
VIM
I
VIM

>// else take the default value 1

you could just write an actual else statement with less characters

no user it's insane to trade physical health for a text editor.

lol just swap ctrl and caps

>Open solution
>Book solves it in a different way

>Go to the next question
>Book assumes I followed their method

>implying I press ctrl with my pinky

>don't use footpedals for control and alt

VS Code doesn't have the performance issues that Atom made people hate Electron for.

>paying for sublime
>not using a hex editor to remove the annoying prompt

I thought Sup Forums was better than this

Jokes you you I still use atom. For C++ too.

I am trying to be a good christian

>2017
>People still fall for this meme

With Linter, C++ in atom is bearable

Why are there no good programmers on Sup Forums? Why does this board attract so many sepples users and other nodev brainlets?

Don't forget clang-formatter. And you mean clang-lint, right?

C++ is trying to be bearable though. Muh modules and ranges. Hopefully UFCS too (not counting on it).

Don't want to stay behind, user.

spacemacs is glorious, user

spacemacs is ergonomic as fuck

You forgot. dvorak. colemak. Wrist support. Finger support. Lumbar support. Gel pads. Trackball mouse. Medication. Reiki. Feng Shui.
Must be a lot of fun to press key chords if you fags are willing to go through all of this for a fucking text editor.

Does Amazon lack infrastructure down there? I would think it would be cheaper since things are generally closer together compared to America.

...

D already has all of those.

I don't really underatand the need for UFCS in sepples. I prefer knowing when something is a free-standing function. Also, it feels like it would slow down IDE search.

>Why does this board attract so many sepples users
fyi, those are called "professional software engineers" irl, as in they get paid writing software using a real world language

GC. Why D didn't adopt C++'s smart pointers when it had the chance?

> I prefer knowing when something is a free-standing function
You don't document your member functions

>his language doesn't have strtok

No one uses strtok, not even C fags

stdarg.h is weird

>no matter how much you learn in CS there are more new stuff being created than you can ever hope to catch up

is the optimal play to pick a niche and specialise? Should I become a JS specialist?

> Why D didn't adopt C++'s smart pointers when it had the chance?
Because smart pointers are useless without move semantic, and C++ didn't get it until 2011, by that time D was already balls-deep in GC. In a sense, modern C++ is more innovative than D.

>those are called "professional software engineers" irl
That just reflects the sorry state of the entire field.

>they get paid writing software using a real world language
Yes, and this software sure is fast, memory-efficient, space-efficient, reliable, bug-free and feature-rich; "real software" is a testament to the virtues of sepples.

I see you learned a lot from yesterday's discussion. I hope you will start using strtok with gusto, user.

Remember D was being built before the advent of smart pointers in C++.
Also the GC isn't as big of an issue as you think. You can use RAII or a mixture of GC and RAII (e.g. use RAII for the critical points of your application where you can't afford the GC's latency). There have been good developments recently on making the GC 100% optional. As it is now, it's almost perfect. The biggest drawback is losing a few runtime and library features.

I'm still waiting for a full-featured web-browser written not in C++.

I'll stick with my split thanks

By the way, do you know what other people are called "professional software engineers"? Java programmers.

In C++ why can't I directly modify the value of a pointer by doing the following?
int x = 1;
int *px = &x;
px = 1;

*px refers to the value of variable x, but px itself is a hexadecimal value, right?

You can, it just won't access valid memory.

Why is Microsoft so shit?

>Windows is written in pure C
>There is still no good compiler/IDE for C on Windows

Visual Studio doesn't count, it's shit for pure C and i had problems even with C++(11) not working in VS but working with MinGW/Clion

> Also the GC isn't as big of an issue as you think
Here we go again. Why do D-fags shill to C++ crowd and not to Java/C#/Python whatever? GC is too big of a stumbling blog for C and C++ programmers to even consider D, whatever hacks Andrei is going to come up with.

Integers and addresses are not interchangeable. Try px = (int*)1.

can I still post here if some of my columns exceed 80 characters?

>still waiting for an X not written in Y
Later when that happens...
>still waiting for a Z not written in Y
Later when that happens...
>still waiting for a P not written in Y
etc. Until your joke of a language finally loses momentum and dies.

>windows
Found your problem

>px itself is a hexadecimal value, right?
dissociate yourself from this way of thinking

px is a[n integer] pointer. that means it's some memory address, very likely a virtual one. it's not hexadecimal, octal, binary, ternary, pinary or anything of the sort. it's a memory address.

It's not happening tho, even Servo is being integrated into Gecko piece-meal, not replacing it.

But clang returns an error.
So to change the value of a pointer (and not the value to which it points), the right hand operand usually has to be a reference to a different variable?
I understand, thanks.

>GC is too big of a stumbling blog for C and C++ programmers to even consider
No, it isn't. The only blight it brings upon D is the existing reliance on it in some place of the library and runtime; thankfully, there's an ongoing effort to make it 100% optional in that regard. In the meantime, there are both alternatives in the standard library for the loss of functionality and in external libraries. Furthermore, as I've said, the evils of GC are overstated. If you know anything about software engineering, you'd realize having GC isn't a big deal as long as you can disable during critical points. Finally, "shill" is a buzzword that completely devalues your arguments.

Just created a channel for dem gay /dpt/ threadshots
t.me/dailyg

>It's not happening tho,
It'll die just like countless shit-tier "industry standard" tools did before it. For now they can get away with throwing more money at problems to make them disappear, but eventually software is going to get too complex for the pile of shit that is C++ and throwing more manhours to try to work around it will become a net loss.

>the right hand operand usually has to be a reference to a different variable?
No, it just has to be a compatible pointer type. (int*)4 and (char*)4 don't necessarily point to the same memory location. So "pointer = 4" doesn't work.

Ok, I get it. Thanks again.

I don't think they have as much, maybe a warehouse or two in germany but not more.
Internatlonal shipping is more expensive because it crosses borders even though they're within the EU (probably postal union regulations), and I can't buy cheap books like you can from India. The Swedish sellers take $110 or something for any hardcover book, doesn't really matter which one, so that's not an option.

Heh, D beats C++ any day if you are doing text manipulation

text manipulation has been C (and by extension C++)'s weakness for decades, so of course D beats it, because even python or javascript do as well

Vs code and vim for anything command line master race.

I'm not talking about technical merits of D's GC, I'm talking about the fact that no serious C/C++ programmer would consider using anything with GC if he can avoid it. And if he can't, he would use some popular language with lots of libraries, like Java and C#.
>ongoing effort to make it 100% optional
Why would I use a language, designed around GC, without GC?
>ongoing effort
This looks like an apt description of D in general: an ongoing effort, just wait a little, soon it'll be done.

And Perl beats D. Who cares.

There's a reason why every industry where performance is absolutely critical, from hedge funds to CERN, uses C++.

>This looks like an apt description of D in general: an ongoing effort, just wait a little, soon it'll be done.
To be fair, that fits C++ also, with its continual "the next standard will be good!"

And perl beats both, it doesn't mean it's any good.

Comparing perl to D is retarded. Comparing C++ to D isn't

C++ has been good since 11.

...

No, it took 2 releases to fix C++11

Perl is good, though.
You don't use a systems programming language to do text manipulation. You use the adequate tool for the job, unless of course you're severely autistic and need to make everything needlessly complicated to feel accomplished.
Nobody uses either C or C++ for text manipulation because it's not what they were designed for. If D can do it that's great, but nobody cares.

Sure, whatever you say.

Comparing system languages based on their ability to manipulate text is retarded too. Besides, I'm pretty sure C++ + Boost beat whatever D can offer, so it's more like a library issue and not a language one.

C++ wasn't usable until 11.
All I care about in C++14 and C++17 is library stuff, stuff I can live without or handroll.

I have a question:
Why isn't strtok implemented like strlen, only with a XOR operation first?
git.musl-libc.org/cgit/musl/tree/src/string/strtok.c
git.musl-libc.org/cgit/musl/tree/src/string/strlen.c

So I'm aware that there are more specialized ways to embed a scripting language into C, but if I want to keep it simple and general, are pipes a reliable way to go? That way the user can script in any language he or she wants, and just send a couple of bytes into C to run the functions. Or is there a significant performance overhead for going down this route?

>You don't use a systems programming language to do text manipulation.
C++ is a purist language, one of the very rare out there. It's used for everything so I don't see the point.

MS Word, Visual Studio etc are written in C++

D's ranges is shit ton better than anything boost has, don't delude yourself if you don't know what you are talking about. D is miles ahead with it's Ranges, iterators and UFCS. I used boost and range v3 myself. Too weak compared to that of D

>I'm not talking about technical merits of D's GC
Then we've reached the root of the problem: nobody wants to talk about how maybe, just maybe, that a GC isn't pure evil. You can make a performance critical program with a GC enabled by disabling at important junctions (which you do with D!). And even then, as I've said before, though D was designed around the GC, things have been moving against that. There are easy alternatives you can use within the language that obviate the downfalls of the disabling the GC.
With regards to using Java/C#/similar, they suck in both performance, design, and features compared to D.
Instead of spouting these opinions that reek of someone not knowing about D and GC in general, I suggest you go to the D forums and website to learn it.

C++ is usable since C++11, it's just getting better since then. nogc is an `ongoing effort` I'm not supposed to be using right now, yet D-fags keep shilling it as if it's stable.

Spouting these ignorant opinions and blabbing about "shilling" is just proof you don't anything about D but shitposts.

Unless you're talking about highly academic circlejerks this isn't even true. The phenomenon of having to learn some new bullshit every six months only exists for nu-male languages in nu-male professions: namely js "code ninjas." Unless you want to be a nu-male, this isn't a problem.

>C++ wasn't usable until 11.
Which is why it was so widely used? Wait.
It wasn't good, but was definitely usable.
>It's used for everything
"Everything" just means that any kind of application of project can conceivably be written using C++.
That doesn't mean you should write sysadmin scripts in C++.

what language would be best for writing a program which calculates someone's intelligence?

Anime.

Why do sepples fags keep shilling for their shit-tier anti-language? They're like a human form of cancer.

>That doesn't mean you should write sysadmin scripts in C++.
Which is why C++ and shell languages like perl don't mix. Same goes with D and perl.

Thank you for proving my point though.

Because you keep bitching about it.

>proving my point though.
Which was? That C++ can do anything? Yeah, it can.
>shilling
C++ doesn't need to be shilled.