[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 342
Thread images: 30

File: 1480956343871.jpg (675KB, 940x822px) Image search: [Google]
1480956343871.jpg
675KB, 940x822px
What are you working on, /g/?

Old thread: >>61992323
>>
Thank you for posting an anime image.
>>
java is objectively the best language
>>
File: lib.jpg (30KB, 500x492px) Image search: [Google]
lib.jpg
30KB, 500x492px
>>
>>61999373
>fasta
> https://benchmarksgame.alioth.debian.org/u64q/program.php?test=fasta&lang=go&id=3
>calls three functions sequentially instead of running them in their own goroutine

>pidigits
> https://benchmarksgame.alioth.debian.org/u64q/program.php?test=pidigits&lang=go&id=3
>calls C code

>regex-redux
>calls C code

yeah, no wonder...
>>
I wanted to learn a fast and easy scripting language. I was thinking about lua, but maybe an easy compiled language like golang would be better.
>>
just paid $150 for the A* algorithm unlock on unity
>>
>>62000209
literally python
>>
>>62000209
What's the motivation for learning either? Are you new to programming?
>>
>>62000208
lol go is so bad it has to cheat in benchmarks by using C libraries. SAD
>>
>>62000209
Go away, Rob Pike.
>>
File: obstreperous laugh.jpg (36KB, 482x413px) Image search: [Google]
obstreperous laugh.jpg
36KB, 482x413px
>>62000211
>paid $150
>for babby's first AI algorithm
>>
>>62000224
all python programmers must be killed
>>
>>62000209
Choose a Scheme, for your sanity.

>>62000198
Bait.
>>
>>62000208
It's a terrible trend.
The website owners acknowledge it even. They should benchmark how much of the code is written in the stated language too.
And even that's too weak a measure since you have so many languages that write the most stupid shit that's essentially C code in their higher level languages.

We need a good measure for semantic complexity.
>>62000234
Virtually every language does. The exceptions are C++, asm and Java.
>>
Rewriting C++ game engine in C.
Fuck trying to rnimplement class inheritance made in cluster fuck of sepples.
>>
>>62000292
You don't have to write oo in C++.
But I support your decision.
>>
>>62000289
chapel, swift, fortran
dumb go poster
>>
>>62000234
>cheat
calling C code is what makes it slower
>>
>>62000309
>lists languages
What for? And I don't use go nor am I defending it.
>>
>>62000231
I know c and a bit of c++ and c#, but it takes a while to get a prototype to work in these languages. I usually use matlab for prototyping, but its performance is quite slow, so I wanted something faster.
>>
>>62000292
>C better than C++
>W-why is it so hard to write this code in C?
The length Cniles will go to prove their language isn't outdated is hilarious.
>>
>>62000289
C?
>>62000209
Shell scripts do 80% of what you want for 20% of the development time in accordance with the pareto principle, there's also python for the ambitious pajeet
>>
>>62000355
https://www.youtube.com/watch?v=1PhArSujR_A

C++ucks will try to defend their horrible language.
>>
>width
>height
>th
>ht
why is english so fucking retarded?
>>
>>62000377
>depth
>weight
Literally nothing wrong
>>
>>62000377
You made the linguist in me cry. Please consider your physical removal.
>>
>>62000377
I'd much rather write widþ and heȝt personally.
>>
>>62000406
>dþ
>ȝt
why is *THIS_SHITTY_LANGUAGE* so fucking retarded?
>>
>>62000376
C++ developers will work while C developers whine, try to write equivalent code, and fail.
>>
File: the_face_of_the_anglo.jpg (89KB, 539x960px) Image search: [Google]
the_face_of_the_anglo.jpg
89KB, 539x960px
>>62000377
because it was conceived by anglos
>>
>>62000399
>linguist
I also know Russian and Swedish.
>выcoтa
>шиpинa
and
>bred
>höjd
all fucking rhymes
>>
>>62000377
wid TH
hei GH t
The digraphs are th and gh, not th and ht. They're also pronounced differently. Be glad your language doesn't have two words used interchangeably for width and length at least.
>>
>>62000448
Digraphs are evil. One letter, one phoneme.
>>
>>62000439
Bredd and höjd don't rhyme, and bred (wide) and höjd certainly don't.
>>
>>62000208
also, to add: Go won't use AVX2 code (not always, anyway), AFAIU. that's because it's not part of the amd64 spec, but an extension...
I just tested the C++ fannkuch-redux locally in my system (a shitty 4-core AMD cpu that lacks AVX/AVX2), and it takes exactly the same time as the Go program...
>>
In today's episode of "teach me C++":

I have a class with a member list of unique pointers:

class MyClass {
public:
MyObject& getObject(int index);
private:
std::vector<std::unique_ptr<MyObjects>> _objects;
};


This class is sort of an ObjectManager, so it makes sense for it to have ownership over the objects, so I made it a unique_ptr. However, I'd like for other parts of my code to be able to access the objects too, through the getObject method. But I don't want them to be able to overwrite it, they should basically have read-only access. So I figured it makes sense if getObject returns a reference to MyObject...

So that leaves me with 2 questions:

1: What's the syntax for this? What should the definition of MyClass::getObject look like?
2: Does this break the semantics of unique_ptr in any way?
>>
>>62000289
>They should benchmark how much of the code is written in the stated language too.
Wheee! I see an idiot. Every single class on optimization ever teaches the same thing, and faggots keep not doing it.

***Profile*** the code first. See where the time is spent. Optimize the critical path only. If there isn't a bottleneck, leave that code alone and put your effort elsewhere.
>>
>>62000523
>1: What's the syntax for this? What should the definition of MyClass::getObject look like?
MyObject& MyClass::getObject(int index)
{
return *_objects[index];
}

>2: Does this break the semantics of unique_ptr in any way?
Nope. Unique_ptr represents ownership. If it is guaranteed by the structure of your program that the instance of MyClass will outlive the function that requests an object from it, then it is semantically valid to return a non-owning reference.
>>
>>62000211

Even if you're a complete washout in computer science, you could have just copied this for free off of Rosetta Code with a few modifications.

https://rosettacode.org/wiki/A*_search_algorithm
>>
>>62000537
Conventional wisdom isn't always right. If you always keep it in the back of your head to write efficient code, you won't get trivial inefficiencies spread out all over the code.
>>
>>62000578
Thanks m8. That clears things up.
>>
>>62000661
Re-stating this question from the old thread.
>>
File: 14453526565790.jpg (7KB, 250x241px) Image search: [Google]
14453526565790.jpg
7KB, 250x241px
https://www.youtube.com/watch?v=sxMVYX5Ua5k

How can programming tutorials be more edgy than CoD montages?
>>
>>62000640
Also, consider returning a const reference if you don't want it to be possible to alter an object using getObject.
>>
>>62000377
>Weite
>Höhe
>te
>he
why is german so fucking retarded?
>>
>>62000731
>arab
are bombs programmed in C?
>>
>>62000731
>windows
>programming
found your problem
>>
>>62000729
even with a degree the best thing is to have a network of people in the industry who will vouch for you. it seems slimy but i think it's the truth
>>
>>62000731
Is this going to get me v&?
>>
>>62000731
>arabic writing
>french os
checks out

captcha: rue de russe
>>
>>62000377
>why is english so fucking retarded?
Because it's a bastardised mix of Saxon and Anglean-Frisian, with influences from Old West Norse, Western Modern Norse, Frankish, Latin, West Frisian, and plenty of other languages.
>>
>>62000770
>slimy
Not at all. Hiring someone is a big committment and it's difficult to make sure of all the other aspects (social, mainly) of being a good employee outside of technical knowledge.
>>
File: qqqqqz.png (743B, 272x168px) Image search: [Google]
qqqqqz.png
743B, 272x168px
Why does >> overloaded operator print correct age of object, but name is not correct? prints random stuff. Picrelated.

[CODE]#include <iostream>
#include <vector>
#include <memory>
#include <cstdio>

class Human {
public:
Human(const int& param1, const std::string& param2) : Name(param2), Age(param1) {}
Human& operator=(const Human& param);
Human& operator>>(const Human& param);
void PrintParams(const Human& param);
private:
std::string Name;
int Age;
};
Human & Human::operator=(const Human& param) {
Name = param.Name;
Age = param.Age;
return *this;
}

Human & Human::operator>>(const Human& param) {
printf("%s %d : \n", param.Name, param.Age);
}
void Human::PrintParams(const Human& params) {
std::cout << params.Age << std::endl << params.Name << std::endl;
}

int main() {

Human k{10, {"James"}};
Human z = k;
z.PrintParams(z);
z >> z;
} [
/CODE]
>>
>>62000781
you are now on the blacklist.
>>
>>62000828
when in conversation i think of whether i am talking to this person because i might need something from them later on. i don't like that
>>
File: wy wiene keningen.jpg (43KB, 797x586px) Image search: [Google]
wy wiene keningen.jpg
43KB, 797x586px
>>62000827
>Frisian
>>
>>62000427
>equivalent code

There's the problem. C++ code is always a magnitude worse than C code, it creates bad arcitecture, bad abstractions, and generally bad everything. The language shapes the problem, it shapes the way you think about the problem. The solution will be differnt if it was coded in C rather than C++. As it will be with FORTH, Prolog, Lisp, Haskell, etc.
>>
>>62000876
All valid, but then it begs the question why you are trying to translate a C++ game engine verbatim into C.
>>
>>62000895
I'm not that poster. I also think that poster is stupid.
>>
>>62000731
dumb frogposter
>>
>>62000836
>Human(const int& param1, const std::string& param2)
>Human k{10, {"James"}};
why are you using references and passing values?
>>
>>62000208
>>62000522
I just realized... how is this not considered cheating? debian itself doesn't distribute binaries that use AVX natively, for example...
>>
>>62000836

You fucked up your code tags, mate. It should be all lower case, and you forgot the [ in the closing tag.

Also, %s is for printing C strings (char*, const char*), not std::string. Your printf call just arbitrarily interpreted the bytes of the std::string as a pointer. I'd be surprised that it didn't segfault.
>>
>>62000350
julia?
>>
>>62000963

But std::String is const char* internally, i thought it would print using %s
>>
>>62001006
std::string is ugly sepples object cluttered with bloat and evil thoughts.
const char* is '\0' terminated const char array.
How the fuck are they the same?
>>
>>62001006
std::string is a class that has a char* variable internally, but it isn't a char*. to get the char* you use the c_str() method.
>>
>>61999941
>A properly configured and hot JVM is as fast as -O2 code if not faster
the only thing i've seen that would suggest that is a set of benchmarks that gets posted here sometimes. they're all simple cases (generally single simple/inlineable functions of simple/inlineable operations on stack-allocated primitives), for which there's no real excuse for any modern JIT compiler *not* to produce such results, especially since it knows for certain the instruction set and extensions available on the machine and can incorporate them into generated code without runtime branching or separate builds, a rare natural advantage over native compilers. however, those cases are ideal. in a large/enterprise-scale project, the cost of things like other less local/primitive/JIT-optimizable code, overall higher heap utilization/lower stack utilization, and garbage collection would add up. all things considered it does a pretty damn good job, and i can't make any sweeping statements like that it's enough of a difference to make it generally unsuitable (and of course the difference we're talking about is nowhere remotely *near* the difference between optimized native code and a legitimately slow language like Python). but games often do have extremely stringent performance requirements, so it's not at all unrealistic to say that it could legitimately be a dealbreaker for some projects
>>
>>62001074

c_str() worked, thanks.

I feel like C++ is too fucking over engineered. Why the fuck can you overload ANY operator and why the fuck do you have so many types of constructors, holy shit.

My brain is melting already but i still enjoy this clusterfuck
>>
>>62001124
It is, but you should start by knowing what the fuck you're doing.
>>
>>62000602
>Conventional wisdom isn't always right.
This particular piece is. If you insist on optimizing everything, you'll take forever and never ship. Also, most people who "optimize" everything are very good at missing out on real optimizations such as picking the right data structures and algorithms.

Sure, putting bubble sort in asm makes it fast... for bubble sort... but switching to quicksort and ensuring that you don't have to sort so often is better, especially once you've got lots of data. Want to look something up a lot? Don't linear search if you can use a hash table. These sorts of things can give you multiple order of magnitude accelerations; seen that for real many times.
>>
>>62000986
no, but I can be your julia if you want
>>
>>62001149

Its so hard to remember everything. How do professional C++ programmers keep remembering every important aspect of language?
>>
>>62001194
By keeping only the relevant parts in your mind when you need them and having reference material close by.
>>
>>62000211
As a unity developer, thank you.

We need more people to fall for shit like this.
>>
>>62001006

>But std::string is const char* internally
No. An std::string contains at the very lease a size field, a capacity field, and a pointer to the data. There is no guarantee over the order in which they are stored in the struct.

And now that I think about it, your compiler would have passed your std::string by reference implicitly, so the characters it was reading was actually the bytes in the struct.

>>62001124

1. Don't ask "why" with C++. You'll get tired of it. The answer is "because this is a language that was designed by committee and everybody wants something different."

2. It is a clusterfuck, and it can be enjoyable. But to truly master it, you must come to accept that you have the word's largest toolbox at your disposal, and for many tasks you will only need a hammer and a screwdriver, and maybe an odd tool that doesn't get used often (but hey, you have it, so fuck all the other langs, right?)
>>
>>62001194
they don't. people who say they're fluent in C++ are usually full of shit
>>
Turns out sbcl still performs gc even when gc is disabled (confirmed by (room)). Meanwhile, racket doesn't do anything upon (collect-garbage) when gc is disabled, and gc can only be enabled/disabled globally at start. What do?
>>
>>62000731
is it worse than siraj
>>
>>62001222

Well i'm working as C# programmer right now and even C# is becoming too large to remember everything, usually i have to use google for some things. I imagine working as C++ dev takes much more googling.
>>
>>62000876
It's true what they say, can't spell cuck without c.
>>
>>62001243
Stop using Lisp if you need garbage collection, retard.
>>
>>62001261
>Well i'm working as C# programmer

what are C# jobs like? do you have to write web apps with it or what?

literally don't know what people use this language in industry for
>>
I'm working through the tutorial introduction to pic related. Right now I'm on Exercise 1-20:
Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns. Should n be a variable or a symbolic parameter?
I know in general what they are wanting, but what do they mean by
"Assume a fixed set of tab stops, say every n columns."
Not sure where columns come from. Any advice would be appreciated.
>>
File: 15030315388410.png (39KB, 616x197px) Image search: [Google]
15030315388410.png
39KB, 616x197px
Rust is "safe"
https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/fd.rs#L240
>>
>>62001303
Oops, forgot pic
>>
>>62000359
>Shell scripts do 80% of what you want for 20% of the development time in accordance with the pareto principle, there's also python for the ambitious pajeet
Shell "scripts" aren't portable at all and use a shitload of different binaries for what could just be a function which makes them really fucking inefficient. Bash and zsh are a pretend programming language, in reality they're just binary abuses. The only good reason for using this is because you're a beginner who had to learn how to use your shell and basic binaries but was never arsed to learn a proper language. Any half decent scripting language like perl, lua, python, ruby, awk, etc. will do whatever the shell does through very standard functions that don't require executing a whole new binary and actually have programming language features that will be useful to whatever task you have (like proper lists).

Recommending to do ANYTHING through shell scripts other than setting up an environment before launching a program or using it to automate some sequential execution of a program is fucking retarded and just shows that you have no clue whatsoever what the purpose of your shell is.
>>
>>62001296
Are you clinically retarded or merely lobotomized?
>>
>>62001300

I'm writing websites using ASP.NET MVC 5, usually it's very boring. Most of stuff works like

Web request comes in -> hits controller -> controller passes some parameters to ORM framework -> using LINQ or direct SQL query we get some data from DB and pass it back

Then render it at front-end. So its working with DB and rendering information using HTML mostly. Pretty boring desu.
>>
File: b6czXZK.jpg (140KB, 1280x720px) Image search: [Google]
b6czXZK.jpg
140KB, 1280x720px
>>62001268
I'm a Haskell programmer, anon~~
>>
>>62001323
There is no problem here.
>>
>>62001323
people who believe rust is safe because it's marketed as safe and safety is its gimmick lack critical thinking
>>
>>62001350
Figures. Only cucks could possibly fall for the hasklel meme.
>>
>>62000211
jesus christ it's 150 fucking dollars? i was already good and pissed that people would pay for an A* plugin before when i assumed it'd be ten bucks or some shit. dear god
>>
Rust < OCaml < Idris > Haskell > Rust
>>
>>62001361
t. paid nsa shill
>>
>>62001386
Explain why Idris is good. (this is going to be fun)
>>
>>62001222

Which is why Bjarne Stroustrup says he's only mediocre at C++.

>>62001261

Programming in general is like 80% googling, and 20% actually typing shit into the editor. If you're not googling the standard library because you forgot something or because it's fucking massive, you're googling a 3rd party library because there is no way in hell you're going to remember that shit.

>>62001323

Rust is "mostly" safe. There are cases where you must use unsafe blocks, and when you are dealing with syscalls (or C wrapper functions that do nothing but invoke a syscall), you are pretty much playing by the kernel's rules.
>>
>>62001389
t. rustlet
>>
>>62001386
... Idris > Haskell > OCaml > Rust?

>When Idris programmers are asked to symbolize their logic
>>
>>62001194
No one does. Just remember the important parts, and if you forget what the name of some Class was or how some library works or whatever you just google it. People who tell you to memorize everything are full of shit and most likely sub-par programmers.
What you need to know is the non-language specific patterns and design principles. If you know how Trees, Maps, and Objects work and how to properly use them you can learn most of an OOP language to an extent in a day or two.
>>
>>62001300
aside from webshit, a lot of companies like to use it internally for tools/testing/automation
>>
>>62001330
>want to write a image downloader for a certain website
>write a 1 line of bash + sed + curl

vs
>want to write a image downloader for a certain website
>write a 20 line python program that runs slower than the bash one

gee i wonder what i'll use for this case
>>
>>62001432
the best languages are written for the people who wrote it, and the worst are written for others
>>
>>62001194
>How do professional C++ programmers keep remembering every important aspect of language?
I've been working for only a year, but http://en.cppreference.com is an extremely nice source of information, complete with examples.
>>
>>62001422
I never claimed it is good.

>>62001441
I haven't yet decided which I think is least bad out of OCaml and Haskell.
>>
Protobuf compiler is finally starting to shape up.

Not included in screenshot but main.rkt contains:
  (load-protobuf "main.proto"
#:extra-proto-path "tests/files"
#:export ([tests.files.Color => color]))
>>
>>62001542
>protobuf

what's this?

from your image i don't see any compiler.

you're just print color names or whtever
>>
Reminder that programming by editing raw text is a decades old idea that has long outstayed its welcome and we should be using editors that work on typed ASTs instead
>>
>>62001556
Retards belong on >>>/r/eddit/
>>
>>62001482
>I don't know how to use the scripting language I have and the libraries that are freely available to me for downloading and parsing web pages so I'll make a bash "script" that literally uses 100 binaries a second because even the conditions in my if-else and while statements are handled by a separate binary
sure thing senpai
>>
>>62001422
it's a shibboleth
>>
>>62001331
Are you? Lisp is not C and SBCL is not a Lisp Machine. The language is literally made to be garbage collected, and regardless of dialect, most Lisp implementations are very efficient at it.
>>
File: Capture.png (975B, 412x36px) Image search: [Google]
Capture.png
975B, 412x36px
I'm trying to make a program using Python, and I found a little problem, here's what I wrote:
def w_init():
L1=Init()
L2=[L1[1]]+[L1[1]+L1[2]]+[L1[4]]
S=[['',0]]*(L1[1]*L1[2])+[['',0]]*(L1[3]*L1[2])
j=0
i=1
while j<2:
S[j][0]=str(i)
print(S)
j=j+1
This is actually just a draft.
The function Init() return a list.
The problem (as shown in pic related) is that in the first iteration, all the S[j][0] change instead of changing each per iteration. Does anyone have any clue what caused this problem?
And sorry I'm new.
>>
>>62001243
How badly do you need to forego garbage collection?
>>
>>62001578
Both, then. How unfortunate. Get well soon.
>>
>>62001570
ahahah

>muh compiler
>muh protobuf

>retards belong on reddit

so why aren't you there?
>>
>>62001597
It's mandatory for critical sections.
>>
>>62001612
It takes literally 1 second to google "protobuf" and maybe 5 minutes of reading to figure out how it relates to compilers
>>
Have any of you wrote custom std::vector like type in pure C? How does it perform compared to C++ vector and more importantly was it easy to use?

I suppose it's done using macros?
>>
File: i_have_fallen_and_i_can't_get_up.jpg (174KB, 1024x701px) Image search: [Google]
i_have_fallen_and_i_can't_get_up.jpg
174KB, 1024x701px
>Reminder that programming by editing raw text is a decades old idea that has long outstayed its welcome and we should be using editors that work on typed ASTs instead
>>
>>62001447
Thats not even remotely the arcane parts of C++.
Try explaining, without referencing the manual, all the rules of value initialization. Or the Most Vexing Parse. Or the rules on how Callable works. Or anything thats been in GoTW.
C++ is full of edgechecks and pitfalls, for every one solution there's a dozen edgecases for it.

(As for initialization: off the top of my head I can list the categories but their rules and subtleties always require a reference check..)
>value initialization, direct initialization, copy initialization, list initialization, aggregate initialization, reference initialization and default initialization, static initialization, dynamic initialization, early dynamic initialization (lol), deferred dynamic initialization (thanks c++17)

...oh I forgot about zero initialization after the captcha (applies to some constexpr rules)
>>
>>62001627
Who are you quoting?
>>
>>62000427
>tfw all your c++ shit can be done in 3 lines of python
>>
File: 1502997095041.png (21KB, 400x400px) Image search: [Google]
1502997095041.png
21KB, 400x400px
>>62001638
>>
>>62001618
Can you write those critical sections in a language like C and use FFI?
>>
>>62001620
>can't even explain what he "supposedly " wrote

lmao

off yourself koder
>>
>>62001621
struct Vector
{
void *data;
size_t capacity;
size_t size;
}

// now just fucking realloc
>>
>>62001631
C++ is truly a garbage language.
>>
>>62001654
If I wanted to go through this ass-backward process, I'd write in a jvm language instead.
>>
>>62001661
you forgot a semi colon at the last curly brace
>>
>>62001631
Almost none of this is related to C++. Thanks for demonstrating you're retarded.
>>
>>62001697
value initialization is a nightmare in C++ though, he's right about that.
>>
>>62001661
>slow as shit
>missing at least one parameter (2 for a non-shit implementation)
>no actual implementation
>wouldn't even compile as is
F- see me after class.
>>
>>62001596
A-Anyone?
>>
>>62001631
>Most Vexing Parse
Things like T t(); doesn't work.
>Callable
Something you can "()".

Initialization is pretty much fucked, I agree.
>>
>>62001659
The code on the left side defines an enum in the protobuf language, the REPL on the right side uses the functions color? color->number number->color that were generated from the code on the left. The protobuf languages is designed by Google and has implementations in C++, Java, Python. Usually you run the protobuf compiler on your .proto file and it spits out a new file in the target language, but since Racket supports lots of metaprogramming facilities, my implementation generates the data types during macro expansion.

>>62001683
Racket isn't suited for high performance time constrained programming. I bet you could kind of stave off the GC in Common Lisp if you don't do allocations in your critical sections, but I'm not sure. If you have extreme performance constraints that usually means you have to use an extreme language. Have you heard of Rust? ;)
>>
>>62001706
>Almost
>>
>>62001720
bruh your program is unreadable

>
>>
>>62001621
I wrote a pretty nice one without the use of macros. Was kinda a pain to use, but was still better than C++. I could rewrite the code if i wanted to.
>>
>>62001596
You're creating a list of references. So changing one changes the others.
>>
>>62001618
Lisp is probably the fastest dynamic language. You're gonna need to call a C library from an FFI.
Trust us when I say you would probably want to kill yourself if you were using Lisp without GC.
>>
>>62001726
It's not about performance, it's about predictability.
>>
>>62001763
Julia is pretty fast too from what I've heard.
>>
>>62001176
>If you insist on optimizing everything, you'll take forever and never ship.
Not a given. It depends on the way you do it. Just spending 5 seconds to think whether you could do some of it with bit operations rather than branching can remove bloat that's otherwise spread out enough to not really show up in the compiler. Being mindful of data structures and such is a part of this too of course.
>>62001330
You can write ghetto code that works much much faster than in "proper" programming languages. Stuff like
curl www.somesite.com/api/getdata?query=something&sid=(curl www.somesite.com/api/login?username=$(head -n 1 cred.txt)&password=$(tail -n 1 cred.txt)|grep --only-matching -P sessionId................. |cut -c 10-)) >> results2asdasd.txt
is much faster to hack together than the python equivalent where you fuck around with variables and functions.
>>
>>62001756

Is this good?

https://www.happybearsoftware.com/implementing-a-dynamic-array
>>
>>62001763
Please go be retarded somewhere where retards like yourselves are not an inconvenience to real people.
>>
>>62001763
LuaJIT is pretty fast too.
>>
>>62001724
Most Vexing Parse irritates me because it's already a case of C coercing something to compile where it shouldn't.
int foo(int());

This shouldn't have been a valid function prototype in a C, int() is not a int(*)() and it shouldn't be contextually interpreted that way.
>>
File: cartesian plane.jpg (14KB, 355x287px) Image search: [Google]
cartesian plane.jpg
14KB, 355x287px
What smart ass though it was a good idea to put origin on top left?
>>
>>62001758
Thanks.
>>
>>62001830
On a display? That's how a raster scan works, I suppose.
>>
>>62001661
What about emplace_back, shrink_to_fit, swap, the iterators, etc? Oh, you left out the hard part.

>>62001697
We're talking about people who call themselves experts. Experts would be expected to know basic things of the language, like that.
Whats the difference between:
Foo f{};
Foo f();
Foo f(bar);
Foo f = bar;
Foo f{b,a,r};
Foo f[3] = {b,a,r};
Foo& f = f[0];

or something like..
inline Foo f() { return 42; }
extern Foo foo;

foo f2 = foo;
foo f1 = f();

Which constructors are called for these cases? When is it an error?
I'm a huge user of C++, but the language has edgecases upon edgecases.

>>62001724
That was just a tiny example of how complicated the language can get, to prove that almost no-one can call them an "expert" in C++. Unless you've implemented the standard library, or are someone like Herb Sutter.
As for Callable, I was talking about how it relates to std::decay and std::forward. along with std::reference_wrapper. (think: std::invoke). (And all the extremely weird syntax for PMF (foo.*pmf)(args) and PMDs?)) Not to mention the colossal mental overhead of the upcoming PMRs (not the same 'PM' as the other two types, but rather about polymorphic resource management -- and maybe making std::allocator work)

Oh here's a simple question to test someone's C++ knowledge. What is an std::allocator, and what problem was it created to solve? (It's two, but thats C++.)
>>
>>62001830
It's logical.
>>
>>62001780
I never tried it, figured it was static.
>>62001791
>how dare you criticize my extremely bad decision making
>>
Which linux distro is bundled with java and eclipse or netbeans ready to go? I want to have a live usb that I can program on any computer.
>>
>>62001892
the one you create
>>
>>62001851
But it isn't?
Why isn't cartesian plane like this then?
>>
>>62001783
>is much faster to hack together than the python equivalent where you fuck around with variables and functions.
But it's a hack, don't pretend it's anything else, and use that as an opportunity not to expand it to a whole project. This hack also assumes that the grep, tail, head and cut implementations you used in it will be used in whatever else you want to run it on, which is very likely false. Also, this is neither easily wrappable anywhere and its inefficiency caused by calling so many binaries for such a simple task. With this, you're calling curl twice, head, tail, grep and cut. That's six binaries you're calling when you could only use one, and they all have equivalents in most scripting languages. The issue is that with scripting languages, you actually take the time to do it right, and you actually need to know a programming language instead of being able to hack together a few binaries.
>>
>>62001880
>be clinically retarded
>get called out
>hurr durr it's not my fault that I'm retarded!
>>
>>62001830
I agree that it's silly, but it's because the scan ray starts at the top of the screen.
>>
>>62001915
stop with the mental gymnastics please.

using shell scripts its usually faster and more convenient.

sounds like you can't write shell scripts
>>
>>62001915
If you have python, you surely have grep, tail, head and cut installed.
>>
>>62001631

They say you can MASTER java and c# combined with the same effort it takes to become a passable C++ programmer.

Basically all your time gets eaten by learning core language edgecases and subtleties while javafags move on to learning the much richer and more user friendly standard library quickly.
>>
>>62001955
I'd cut your tail and head, moron.
>>
>>62001967
t. koder
>>
>>62001965
>(((They)))
>>
>>62001982
People like Bartosz Milewski. They are gurus.
>>
>>62002008
Have you tried getting a brain?
>>
>>62002049
I know Java and C++ pretty well and I agree. Haven't looked into C# yet.
>>
>>62001915
Why would I want to do something I can do in 5 minutes in 50?
>>
>>62002049
I'm just a Markov chain.

I don't have a brain yet.
>>
>>62001951
My point is that shell is NOT a scripting language, you're using 6 different fucking binaries for a simple fucking task and wrapping it anywhere would be fucking horrible and makes your "script" unportable as fuck whereas doing it with perl would be portable to whatever the fuck else has perl which is ANYTHING. With this you're assuming whatever else you run this on will have GNU coreutils and curl.

Making personal hacks in the shell is fine but for fuck's sake don't redistribute that shit, don't build an operating system on it and for the love of god don't encourage people to fucking use it for bigger projects and understand that it's only meant for hacks, or else you'd end up with shit like runit and xbps on voidlinux which are great in concept but are entirely limited by GNU Coreutils and whatever binaries they assume there to be. It's fucking retarded.

If you think I'm making mental gymnastics you're a fucking brainlet who doesn't understand what the purpose of a programming language and what the purpose of a shell is.

>>62001955
You might not have GNU Coreutils because you're on Solaris, *BSD, macOS or any Linux distribution that ships with an older version of Coreutils that you assumed was in the environment your script should run on and you might not have whatever other binary you assumed was in the environment, so any of these requirements failing will end in a fucked up script, and shells don't quit with an error. It keeps executing and could likely fuck everything up for errors if you didn't put sanity checks for every binary you're using.

>>62002077
Because you could actually properly learn your fucking programming language and to it in 5 minutes anyway.
>>
>>62002089
Makes sense to me. Sad! Babby's first neural network is technically simpler, yet so much better!
>>
>>62002091
>busybox wget -O -
>busybox head
>busybox tail
>busybox cut
>busybox grep
Why would I distribute a 5 minute hack?
>>
>>62001774
Indulge me: what is it that you're trying to implement that can take 4 seconds to call a function as long as it takes exactly 4 seconds?
>>
>>62002156
busybox wget -O - head tail cut grep
>>
>>62002091
>Solaris, *BSD, macOS
I'm pretty sure all those (except wget) are POSIX, no?
>>
>>62002172
>trump outta nowhere

go back to réddit
>>
>>62002165
Indulge me: how many hours did it take you to build that strawman?
>>
>>62001303
>>62001324

You better work this out for yourself.
But basicaly tab make 8 spaces when there are no chars. If there are say 3 chars there and you get a tab, the tab will do 8 spaces. So basically the tabstop is always at the eight column and then it resets to eight, the number of spaces a tab will put depends on how many characters are in your input in relation to a multiple of 8.

TLDR - tabstop is 8
>>
>>62002190
Ironically Solaris was more POSIX than Linux (and only those that are part of the LSB).
>>
>>62002216
>the tab will do 8 spaces.

CORRECTION : the tab will do 5 spaces, 3 + 5 = 8

IF there are 2 chars it does 6 spaces, 6 + 2 = 8

If there are 12 chars it does 4 spaces, 12 % 8 = 4
>>
>>62002156
Then your script only runs on Linux distributions which have busybox. My point is that hacks are fine, but stick to fucking hacks and don't pretend it should do anything else. And if you plan on wrapping it anywhere, at least do it properly.

>>62002190
They're POSIX, the UNIX Utilities' options and usage aren't part of POSIX, the --argument notation isn't part of POSIX, they use a different set of UNIX Utilities and your script will keep running. Make a shell script to replace a file with a parsed version of it and don't make sanity checks around it and your file will probably be replaced by a blank or garbage-ridden file because your shell "script" will keep executing at the error of whatever command isn't found or isn't used properly and it will keep piping the stdout as if nothing happened. This can't happen if you do it through a proper language with a proper library instead of relying on libraries.
>>
What's the best (most interesting) programming language to code in while on LSD? Lisp?
>>
>>62002255
> instead of relying on libraries
instead of relying on binaries, sorry.
>>
>>62002216
>>62002250
I understand this, what I don't get is what they mean by columns. What do they mean by
"Assume a fixed set of tab stops, say every n columns."?
>>
>>62002256
Malboge
>>
If it's not POSIX it's not PORTABLE.
if it's not PORTABLE it's SHIT.
if it's SHiT then why the FUCK are you using it?
>>
>>62002313
It's fast to write.
>>
>>62002256
Coq, Idris, Agda, Twelf.
>>
Multilingual programming is the future. The more languages, the better
>>
>>62002334
That's why I use Go purely for CGo
>>
>>62002334
Esperanto alone should suffice
>>
tfw compiling Qt from source
this is taking forever on my shitty cpu and that's even after disabling shit like xml, sql, dbus and other stuff I don't need
>>
>>62002442
after trying to compile llvm from source, I decided I'll never do it again if I don't have to
>>
File: 1503238184964.jpg (44KB, 500x1352px) Image search: [Google]
1503238184964.jpg
44KB, 500x1352px
>>62002442
>compiling Qt from source
but why?
>>
>>62002332
>Coq
>Twelf
>Agda
This is what happens when we excuse poor readers and make up a diagnosis ("dyslexia") in order to not hurt their feelings when they're actually just lazy and/or stupid as fuck.
>>
I'm new to this, so bear with me
Why am I not getting anything back from this? Everything seems to be in working order but I'm getting nothing

import socket

target_host = "127.0.0.1"
target_port = 80

#create a socket object
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

#send some data
client.sendto("AAABBBCCC",(target_host,target_port))

#receive some data
data, addr = client.recvfrom(4096)

print data
>>
>>62002466
because I need GCC7 compatible Qt on Windows
>>
>>62002442
The only parts that take long are qtwebkit and qtwebengine. You should try to exclude these if you don't need it.
>>
>>62002255
>Then your script only runs on Linux distributions which have busybox
https://frippery.org/busybox/
>>
>>62002505
Thanks for the heads up, I only need Core, Gui, Widgets and QML/Quick, the problem is that Qt docs are outdated when it comes to configure script and half of the options you have to really guess.

Also for some reason I'm getting linker errors related to SQLite (even though I've disabled SQL module) and zlib (even though I instructed the build system to use the zlib dependency shipped with Qt). There goes my evening.
>>
>>62002491
Well do you have any UDP server on port 80 that responds to AAABBBCCC?
>>
File: 1502107055168.png (61KB, 724x810px) Image search: [Google]
1502107055168.png
61KB, 724x810px
Why aren't you programming in C# right now?
>>
>>62002491
SERVER EXAMPLE
import socket

serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', 8089))
serversocket.listen(5)

while True:
connection, address = serversocket.accept()
buf = connection.recv(64)
if len(buf) > 0:
print (buf)
break


CLIENT EXAMPLE
import socket

clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect(('localhost', 8089))
clientsocket.send('hello'.encode())
>>
>>62002646
>MS Java
gross
>>
>>62002646

Because i'm programming in C++ right now. I'll have enough of C# tomorrow when i go to work.
>>
>>62002646
What an awful programming language
>>
>>62002646
go back to /v/ vermin
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>62002646
Because I'm not a retarded Javatoddler lmao
>>
>>62002463
Fuck, I tried to compile llvm from source with visual studio the other day. I have 16GB of ram, so I keep the swap/pagefile disabled. Big mistake. Watching the memory usage go from 2GB utitlized to 15.9GB was a rollercoaster, every 10 seconds. It looked like I was about to run out of memory and have a BSOD, as the line chart was creeping towards the top, then to fall back down. Eventually the build errored out because the compiler ran out of heap.. and it wanted to rebuild the whole thing again.
>>
>>62002646
Sorry, I only use non-shit languages.
>>
>>62002656
thanks
>>
File: ff.png (58KB, 600x355px) Image search: [Google]
ff.png
58KB, 600x355px
>>62002689
your png is now optimized
>>
>>62002646
Because I don't want to depend on Microsoft.
>>
>>62002661
>>62002663
>>62002722
>>62002745
>C# jobs paying + $90K
>muh reasons
>>
>>62002767
Actually they pay $20-30k. But hey, keep dreaming.
>>
>>62002767
You don't write for fun what you write for work.
>>
>>62002767
There's more to life than money, anon.
I hope you develop spiritually.
>>
>>62002722
c# is a very comfy language
>>
>>62002794
>spent all my life counting pennies
>some anon has the balls of saying "There's more to life than money"

you must be a rich fag
>>
>>62002831
Would it have been different if the pennies had been worth more?
>>
>>62002831
Well, yea. How else would he know.
>>
>>62002767
>>62002779
>similar jobs pay different amounts in different locations
woah
>>
>>62002834
probably.

my country changed its own currency to Euros though
>>
>>62002829
When compared to the loofree streets of india perhaps.
>>
>>62000152
Rust Toddler here, trying to learn it and reading the rust programming language book, are there any better resources? I like it but would also like to take a look at any alternatives
>>
>>62002301
Basically input starts in the first column, each char you input had on more column, the tab stops at every eight column.
>>
>>62002852
That's the joke.jpg
>>
>>62002858
£
>>
>>62002862
be sure to follow the code of conduct and don't even think about misusing gender pronouns

https://github.com/rust-lang/rust-www/issues/268
>>
>>62002858
Ireland?
>>
>>62002878
?
>>
>>62002871
Thanks!
>>
>>62002834
Best pennies were when pound was divided into 240 pennies
>>
File: 7721.jpg (199KB, 719x799px) Image search: [Google]
7721.jpg
199KB, 719x799px
w-why aren't you using the industry standard language? d-don't you want to get a j-job?
>>
Boys, why is this not ever entering the if statements? I'm doing some awk / sed programming and trying to increase either greek or latin if the line ends with greek or latin

{ if ($0 ~ /.Greek/) greek++; else if ($0 ~ /.*Latin/) latin++; }
>>
What's wrong with C#? It's literally good Java. Name anything except being tied to (((Microsoft))) (not anymore with .NET Core though)
>>
>>62002891
nah

Iberian peninsula
>>
>>62002927
./*Greek

the missing * was a miss type.
>>
>>62002923
stop shilling your currency
>>
>>62002930
C# is Java but with extra shit haphazardly shovelled on.
>>
>>62002930
Java is better than C# in literally every way.
>>
>>62002927
err never mind, i figured it out.
>>
>>62002930
The name is cringe
>>
>>62002966
not an argument
>>
>>62002960

C# is Java with extremely useful functions. Such as async/await, delegates (function pointers like in C/C++).

Everything is easier and works better in C#. Java is Pajeet shit. Just look at crap Runnable<T> compared to C# threading.

>>62002966

Not an argument[2]
>>
>>62002966
I thought the name was C#
>>
>>62002925
I am. The codebase at work is an ancient shit heap, infested with 90's object oriented crap. Everyone is so afraid of changing anything cuz the code is so old and bad that they pile on more shit and hacks rather than actually fixing anything.
>>
>>62002646
because I am on the superior language, java
>>
>>62002887
>grasping at straws this hard
lol
>>
>>62002995

Rewrite it in C++11 and make it good you faggots. I bet your code is full of memory leaks and what not.
>>
>>62003008
good goy
>>
File: kergina and donis.jpg (125KB, 300x377px) Image search: [Google]
kergina and donis.jpg
125KB, 300x377px
Anons I'd like to make a 2d game like cave-story, I even downloaded the NXEngine but being a total newfag I don't understand a single bloody thing (reading the source code). I got myself the ebin C book (picrel) but it's mostly reference that doesn't really tell you how to do stuff. Are there any decent resources I could get into?
>>
>>62002992
delegates are stupid, functional interfaces are superior
>>
>>62003048

Only if you are Pajeet.
>>
File: c02.jpg (194KB, 650x817px) Image search: [Google]
c02.jpg
194KB, 650x817px
It just isn't fair bros.
>>
who here watching the barca game?
>>
>>62003115
>spending time photoshopping in order to get (You)s
>>
>>62003058
>not an argument
>>
>>62003123
me la
>>
File: 306607.jpg (29KB, 225x350px) Image search: [Google]
306607.jpg
29KB, 225x350px
Remember that C++ is both the fastest and most efficient language!
>>
How can I start making some money? I'm good at making websites, I figure that can be a quick way to earn cash. Has anyone done anything on sites like Upwork? How is it?
>>
>>62003167
it's not efficient in terms of lines of code
>>
>>62003171
Get some skills and a real job (read: stable contracts) instead of trying to compete with Indians working for pennies on freelancing sites.
>>
>>62003195
std::sort :3
>>
>>62000170
You are welcome
>>
>>62002779
t Europoor
>>
If Rust was becoming popular, how would we know?
>>
File: Yakumo.Ran.full.1823527.jpg (642KB, 775x1100px) Image search: [Google]
Yakumo.Ran.full.1823527.jpg
642KB, 775x1100px
>>62003167
>fastest
>>
>>62003287
More job offers for Rust devs?
>>
>>62003287
Same question for D 2.0
>>
>>62003301
How to search? When you search for Rust jobs for painters etc come up lol
>>
>>62003167
Why does /g/ like Nene so much again?
>>
>>62003167
Java though
>>
>>62003378
>doesn't even have real arrays
>fast
>>
>>62003391
Once you are skilled, it is literally the most effective language. It has a higher skill cap than other languages, so its understandable that you wouldnt be able to "get" it
>>
>>62003036
A Modern Approach to C Programming is pretty decent if you're a complete beginner. Good luck getting a physical copy for less than $70 though.
>>
Developing C++ on windows, qtcreator or kdevelop?
>>
I've dicked around with C and Java in the past but never got beyond simple programs (temperature conversion, tax calculator, etc.) I'd like to get back into learning. what's a good place to start? I'm not married to any one language, I'm more concerned with learning concepts right now.
>>
>>62003534
here mate. just get "with it" iwth the banter and you'll be able to swing it with the best of them in no time!
>>
>>62003528
visual studio
>>
>>62003167
I'm taking the bait.

Assembly is by far the best language.
FORTH is ubermensch tier, as well.
>>
>>62003528

If you must use an IDE, Qt Creator is the way to go.
>>
>>62003612
Fuck off microshill
>>
>>62003660
>Developing on windows
>Fuck off microshill
take your meds
>>
Improve my Haskell code /g/ (You can't)
>>
>>62003708
(`any` "aeiou") . (==)

i'm here all day
>>
>>62003708
>isVocal 'A'
>False

0/10
>>
>>62003686
>developing on linux
For what reason?
>>
File: 1503212731084.png (344KB, 603x800px) Image search: [Google]
1503212731084.png
344KB, 603x800px
>>62003575

Not sure if serious
>>
>>62003708
fn is_vocal(c: char) -> bool {
"aeiouAeiou".contains(c)
}
>>
>>62003732
probably should've used elem
but whatever
>>
>>62003769
Oh whoops
fn is_vocal(c: char) -> bool {
"aeiouAEIOU".contains(c)
}
>>
>>62003732
>>62003741
(`elem` "aeiouAEIOU")

shiiiiiiig
>>
>>62003794
>>62003780
>>
>>62000523
>>62000523

Follow-up question to this:

What if I want to return the whole list of objects, but references to them. So transforming my std::vector<std::unique_ptr<MyObject>> _objectcs to std::vector<<MyObject&> _objects.

Is there a better way than looping through the whole thing and adding them to a separate vector? I'm guessing no.
>>
>>62000152
Who me? not much, learning python
def calculate():
percent = input("Enter the percent you want to calculate: ")
percentNum = input("Enter the number you want a percentage of: ")
result = float(percent) * float(percentNum)

print (result)

answer = input("Do you want to do another?\ny/n: ")

if answer == 'y':
calculate()
elif answer == 'yes':
calculate()
elif answer == 'Y':
calculate()
elif answer == 'Yes':
calculate()
elif answer == 'n':
quit()
else:
print("Please check your choice and try again... ")
quit()

calculate()
>>
>>
>>62000209
% cat myprog.d
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}


quite literally D
>>
>>62003528
visual studio is better
>>
>>62000209
Haskell
>>
File: tendies_reduced_color_palette.png (469KB, 3360x2100px) Image search: [Google]
tendies_reduced_color_palette.png
469KB, 3360x2100px
i am working on a wholesome fun video game
>>
>>62003920
Visual Studio for C++ is extremely lack luster than using it for C#
It barely has any refactoring, you can't use the test runner to run gtest/doctest/catch/etc. The analyzer still can't use things like clang-check. Relying on the CoreGuidelines checker is a bit week, because its more of a style guide and not actual static analysis. There's no way to simple create a .cpp and matching header, without using the "Add new class" "Fill out this wizard" "Click okay." Why can't you just C-x C-n? It barely does any syntax highlighting in 2017.. you have to use R# C++ or VAX to get it to show a macro as a different color than a function call..

And thats just the tip of the iceberg, QTCreator can do all this and more.
>>
>>62003972
Is this homestuck?
>>
>Coding standard
>All code files should include the license at the top.
Why
>>
I just wanted to say that sfml is the best library to make 2d games. fuck you sdl
>>
>>62001830
>>62001912

It's literally "inspired" from the fact that we're(western world) used to write from top downwards, from left to right

Are you a muslim or something?That's why it looks weird to you?
>>
>>62003996
no. this is a next gen video game written in the most highly versatile and superior scripting language in existence: GML.
>>
File: Image15812.gif (5KB, 343x348px) Image search: [Google]
Image15812.gif
5KB, 343x348px
>>62004040
>>
>>62004040
Because the Cartesian coordinate system has been around and used for almost 500 years. (for the idiots: The origin is in the center, at 0,0. Positive coordinates are in the "top/right" quadrant thus "bottom left" should be 0,0).
>>
new thread: >>62004107
>>
File: tendies_dogecoin.png (689KB, 3360x2100px) Image search: [Google]
tendies_dogecoin.png
689KB, 3360x2100px
wow look at this dogecoin. to the moon
>>
any resources for learning the X API so i can write my own glorious c++14/17 tiled window manager? i plan on scouring dwm source later
>>
>>62004111
dumb frogposter
>>
>>62004135
manpages for libxcb
>>
>>62004096
>>62004106
the PC really was meant to replace the paper, it's only logical that you have the same writing concepts as you would do on paper.

Instead of thinking higher/lower being up/down, think as how you would read on the screen
>>
>>62000836
anon, what the hell are you learning c++ from, this is awful in every single way. pick up a book and start at the beginning, i recommend Absolute C++ by Walter Savitch
>>
>>62004177
but why would you do computer 'graph'ics that way?
when you're writing, you're not using consciously using a coordinate system. but when you're moving shapes on a screen..
>>
>>62004221
Computer graphics aren't done that way. OpenGL has the origin in the center of the screen, bottom left is -1, -1 and top right is 1, 1 etc.
>>
>>62001219
>all this C++ hate
this thread is filled with retards
C++ is a hard language, but it never claimed to be easy. if you're got minimal exposure to it, i.e. just a few classes' worth, then of course you're going to suck at it. but that isn't the language's fault.
>>
>>62004329
c++ is my favorite language. not sure what the issue is
>>
>>62004281
yes, because they're not dumb. but the point of the OP was that user interfaces have the origin in the top left.
>>
>>62004329
>>62004350
Alright, since I have you two here please help.

int someVar = 2;

int& func() {
return someVar;
}

auto x = func();
x = 5; // this doesn't update someVar. What gives?


I thought if I changed a reference I'd change whatever it was referencing, but that doesn't seem to be the case. Do I have to just return a raw pointer instead?
>>
>>62002494
because you're writing a Qt-based application? or by chance do you only need the Qt libs for Qt Creator because you want to use it to build a non-Qt application with GCC?
>>
>>62004405
Actually nevermind, I figured it out I think... This is really weird. I swapped auto with int& and now it works. I've never been betrayed by auto before.
>>
>>62000377
>height
>Complains about the ht
>Doesn't complain about the FUCKING G IN THERE
>>
>>62004405
You need to use auto& if you want a reference
>>
>>62004350
i skimmed the thread and saw some mean c++ comments

>>62004405
you're returning an int reference, and auto type-deduction doesn't capture the reference. use auto&. decltype(auto) works too, i think.
http://en.cppreference.com/w/cpp/language/auto
>>
>>62004492
>>62004483
Coolio, thanks guys.
>>
ill write a chess ai with alpha beta but this time ill have progressive deepening, heuristic sorting at each level too
>>
>>62004657
no u wont
>>
>>62000729
i started in the tech support team and then transitioned into an inhouse developer role when they realised i was much more capable than most of the offshore pajeets we outsource to. definitely not the fastest way to go about it but its one path
>>
>>62004752
i will
def get_squares_king(x, y, b):
ctr = 0
adj = [x-1, y, x+1, y, x, y+1, x+1, y+1, x-1, y+1, x, y-1, x+1, y-1, x-1, y-1]
buf = []
me = b[x][y]
for i in range(0, 15, 2):
x = adj[i]
y = adj[i+1]
if(not ((x >= 8 or y >= 8) or (x <= -1 or y <= -1))):
if(not b[x][y] or is_enemy(me, get(b, x, y))):
buf.append([x,y])
ctr+=2;
return buf
>>
>>62003869
>if answer == 'y':
> calculate()
> elif answer == 'yes':
> calculate()
> elif answer == 'Y':
> calculate()
> elif answer == 'Yes':
> calculate()
> elif answer == 'n':
> quit()
if answer[0].lower() == 'y':
...
elif answer[0].lower() == 'n':

or simply remove the elif..
>>
>>62003260
Non-commieforniac burgeristani actually
>>
>>62003746
It's infinitely superior in every single way, shape or form. That's just the development part. Then you have deployment and publishing and if you're using wangblows for that you'll want to blow your brains out. Already trying to do any development on wangblows is hellish enough.
>>
>>62002179
you're not allowed to run this. please implement in python so anon can use it
>>
>>62005108

>You're not allowed to run this
How so?
>>
>>62003528
Qt Creator + CMake + MSYS2 + GCC7
and see below

>>62005050
this. but the battery and charging port on my Arch machine crapped out so for now i'm running the above configuration on my Windows/games machine, and somehow, everything just werks. it let me recreate essentially the exact same build environment as i had on my Arch install (MSYS2 even uses a pacman fork, kek). far and away the most tolerable C++ build environment i've ever seen in Windows. and with GCC7, i can even use the C++ features that Visual Studio hasn't bothered to implement yet in my Windows builds. and my CMake configs can be exactly like they'd be on Arch. find_package actually works sometimes, and when it doesn't, pkg-config/pkg_search_module does. before, getting libraries to load right on Windows with CMake (actually, in general) was a pain in the ass, and would require branching by platform and uglying my configs for my builds to work across Linux/Windows. still prefer a Linux-based dev OS for reasons beyond the build environment, but for anyone trying to work with C++ on Windows, i can't recommend this configuration enough
Thread posts: 342
Thread images: 30


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.