[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Search] [Home]
Board
Settings Home
/g/ - Technology


Thread archived.
You cannot reply anymore.



File: 1547829160546.jpg (746 KB, 1000x1125)
746 KB
746 KB JPG
What are you working on, /g/?

Last thread: >>71375224
>>
File: 1560258429996.webm (1.93 MB, 1280x720)
1.93 MB
1.93 MB WEBM
Use const
>>
>>71383061
This isn't really fair, what if he needed to modify the array?
>>
>>71382765
>>71382764
To me it's an emphasis thing. I put the * next to the type when it seems more logically like it's part of the type, like maybe when I have some overloads that all take a variable x of different types, and one just happens to take a pointer type, it should be int* x, not int *x. I put it next to the variable name when I want to emphasize the "pointerness" of the variable, like if I'm going to do pointer arithmetic or something. It's the difference between the phrases "an object of type X pointer" and "a pointer to an object of type X", they both mean the same thing but they have different implications.
>>
>>71383109
Don't use const then.
>>
File: 1559946247032.jpg (836 KB, 815x1071)
836 KB
836 KB JPG
>>71383132
Putting it on the left is entirely a sepplescuck thing, because of the asine and retarded shit you were just going on about.
In C, it 100% logically makes more sense to put it on the variable, and that is where it was originally intended to go. Even the standard itself puts it with the variable.
>>
File: 19129348239.jpg (136 KB, 1280x720)
136 KB
136 KB JPG
best drug for programming?
>inb4 muh exercise and sleep
fuck off
>>
>>71383227
a cup of tea
>>
>>71383223
We're talking about C++ you dingus, C doesn't have templates or any kind of high level operations on types so yeah, if I was limiting myself to writing C I probably wouldn't put it to the left ever.
>>
>>71383255
Read the reply chain. The original code this was brought up on was C.
>>
Say i'm using c++ and I have some pointer.
And I'm too lazy to dereference it every time I want to modify its contents.

Is it possible to "convert" the pointer to a regular variable? Like, assigning the contents of the pointer to a variable without copying?
>>
>>71383227
coke/speed
>>
>>71383317
template <typename T>
T& ref(T* ptr) { return *ptr; }
>>
>>71383032
someone please explain what i'm doing wrong?
I typedef'd a Queue struct which has a head and tail index (int). I then create a test function defined like so:
void test (Queue q) {
q.head++;
}

and a main function like so:
void main ( ) {
Queue que;
que.head++; // (1)
test(que); // (2)
}

For some reason i am unaware of, incrementing the elements of `que` in main (1) works, but passing it to a funciton and incrementing it there (2) does not actually increment its elements, leaving them unaffected. Why is this, and how do i modify the elements of the Queue in main via a function outside of main?


>inb4 "muh c"
please don't bully
>>
>>71383061
ey rick, lemeaskusumthing *scratches head*, consts.
>>
>>71383340
You're passing a copy, pass a pointer instead.
>>
>>71383340
test is getting a copy of the Queue and incrementing the copy not the original.
>>
>>71383352
>pass a reference instead
ftfy
>>
>>71383340
Queue isn't a pointer, so a copy is passed in. head is an element of q, so it can only be modified locally. If head were a pointer to a value, accessing a copied pointer would work, but it'd be real sketchy since you'd be modifying a value through a pointer from a copied element. Sketchy because pointers should only exist in one place at a time, otherwise you risk dangling pointers and failed updates and stuff.
>>
>>71383317
>>71383325
then again i don't know why you'd do ref(ptr) every time. you can do
auto& var = *ptr;
// alter var to alter *ptr
>>
>>71383375
No, you should only ever pass const references, and since you're going to modify the object, you do not want a reference.
>>
>>71383325
>>71383381
will bad things happen if I free the original pointer after that?
>>
>>71383414
You free the original memory. Any further access is undefined.
>>
File: oh lawd he coming.jpg (303 KB, 1280x720)
303 KB
303 KB JPG
>>71383032
Stupid question but programming related.
In C#, how can I create and write a document in $HOME/Documents in a cross-platform way?
>>
did the anon who wanted to make a bot for some MMO using a microcontroller and then deciding to use python and people told him how dumb he was ever finish the bot?
>>
>>71383414
undefined behaviour
>>
>>71383468
whats wrong with micropython
>>
>>71383460
if(os.startsWith("Windows 9"))
else
>>
>>71383460
A) use a library
B) ifdef WINDOWS #define HOME %USER% endif ifdef LINUX #define HOME "~/"
something like that, presumably.
>>
>>71383478
nothing, the problem was he wanted a bot, which is a program that automates clicks for tedious video games
a microcontroller has no use for botting, unless it controlled a robot hand that actually used the mouse
>>
>>71383409
Absolutely wrong, when you need to modify an object and you will never pass null, a mutable reference is much better than a pointer.
>>
File: 1557772985307.jpg (243 KB, 850x1188)
243 KB
243 KB JPG
>>71383468
Why would the bot need to run on a microcontroller?
Also, I don't think performance really matters for shit like MMO bots, so Python would probably work fine.
>>
>>71383511
>reading compression
I'm talking about that one guy from a /dpt/ from about 5 days ago, he made some decnet progress
>>
>>71383468
No it went the way of 99% of /dpt/ poster's projects: come up with an idea-guy tier idea, post about it here, argue about what language to use for thirty posts, then abandon it completely.
>>
File: 1556594859326.jpg (55 KB, 564x811)
55 KB
55 KB JPG
>>71383483
Anon, that's C#
>>
>>71383532
does my life count as a /dpt/ poster's project
>>
what the fuck are rvalue references who comes up with this shit
>>
>>71383468
this guy >>71298353
>>
>>71383560
Just dump that garbage language already.
>>
>>71383560
cniles and their high level ivory tower abstractions
>>
>>71383560
Found the brainlet.
>>
>>71383569
That is a C++ thing. C has no such concept.
>>
has anyone checked if bjarne is developing alzheimers or dementia, or are sepples cucks simply used to having pure insane garbage shoveled down their throats every few years
>>
>>71383580
>C standard
>What is sometimes called ‘‘rvalue’’ is in this International Standard described as the ‘‘value of an expression’’
>>
>>71383377
How do you recommend that i modify the elements in Queue q?
>>
>>71383604
"rvalue references" is something much more specific, and only related to C++.

In C, rvalue vs lvalue is pretty simple, and largely unimportant when normally writing code.
An lvalue can appear on the left side of an = and & works on it. Basically, it has storage associated with it.
An rvalue cannot, and does not have storage associated with it.

The only exception is non-modifiable lvalues, which include array labels and const variables, which are not valid to put on the left of =.
>>
>>71383460
std::bump();
>>
>>71383634
cringe
>>
>>71383638
https://vocaroo.com/i/s0DBKcPYMJTK
>>
>>71383638
std::teleport();
std::set_position(enemy.back());
std::unleash_katana();
>>
>>71383652
but what you posted was literally cringe
like there was no other appropriate response
>>
>>71383652
kek
>>
>>71383655
assert !personnel && enemy == "kiddo";
>>
Imagine actually struggling to understand rvalue references LMAO
>>
>>71382835
>you don't understand the difference between a declaration and an expression

No that's you.

int x; //the expression x evaluates to an int 
int *x; //the expression *x evaluates to an int

//proof
int x, *y, **z; //the expressions x, *y, and **z all evaluate to an int
>>
so in cpp, if I want to have optional initialized parameters in a function, but want to preserve the order of the parameters being passed, how do I achieve that?

do I have to pass a dummy to pad the parameters to the right, if I have nothing to pass to the first parameter?
>>
>>71383625
If you're using C, you have to pass in a pointer. If you're using sepples cancer, you can choose a pointer, but that's not sepplesy enough, so use a reference or whatever.
>>
>>71383679
Holy shit, the declarations in C makes sense now.
>>
>>71383691
Use overloads instead of default arguments in that case:

void f(A a, B b);
void f(A a) { f(a, B()); }
void f(B b) { f(A(), b); }
void f() { f(A(), B()); }
>>
>>71383652
>no results in archive
>nothing on google
anon...
>>
File: 18134857189.jpg (179 KB, 1074x1074)
179 KB
179 KB JPG
how do i overcome math anxiety so i can become a better programmer?
>>
>>71383808
Programming doesn't have a lot of math. It took until Borderlands 2 before the graphics developer had to learn tangents for field-of-view calculations, and that's baby-tier math.
>>
>all that shitflinging about ambiguous variable declaration and operator syntax
Feels good to be a Pascal chad.
program superiorSyntax;
TYPE
PInteger = ^Integer;

VAR
number: Integer;
iptr: PInteger;

BEGIN
number := 100;
WriteLn('Number is: ', number);

iptr := @number;
WriteLn('iptr points to a value: ', iptr^);

iptr^ := 200;
WriteLn('Number is: ', number);
WriteLn('iptr points to a value: ', iptr^);
END.


Come home, white man.
>>
>>71383829
Go uses similar syntax.
>>
Erm, what happened to all those job opportunities programmers supposedly have? I was promised lots of opportunities and money after I graduate. I can't find a single job opening in PA.
>>
File: fuck everybody.png (83 KB, 1370x994)
83 KB
83 KB PNG
>>71383887
Oh there's plenty of openings. You just had to have a free pass for 5-10 years worth of experience to get them
>>
>>71383887
I smelled early that the industry was rotting, and started focusing much more on my drawing hobby.
Now I make a decent living drawing foot fetish porn + autismbucks, and program for fun.

I love my Art Chad lifestyle, STEM cucks btfo.
>>
>>71383887
It was all a lie.
When companies say they want more people, they are specifically talking about senior-level programmers, but they also have ridiculous expectations about what they can get. Hardly anybody wants to take on less-experienced programmers and actually spend the effort giving them some experience.

The problem is 10 times worse if you went into webshit.
>>
>>71383899
and live in the middle of a major city (and still be willing to commute)
>>
>>71383899
How do I into job out of college though? My dad's going to get really irritated if I end up turning into a neet.
>>
>>71383943
>send thousands of resumes till one sticks
>apply for every job in sight
>>
>>71383943
Do some open-source shit in your downtime.
It counts as real experience, and makes you a much more desirable hire.

I got my first job after only applying to like 5 places, and 2 of those 5 got back to me.
For my second job, I only applied to a single place and got it.
>>
>>71383976
Do you mean like non-trivial projects on github or contributing to Linux tier open source?
>>
>>71383995
Non-trivial github projects are fine. It does look better if you're not the only developer.
>>
>>71383976
Not him but for some reason I never thought to do open source stuff for experience, pretty brainlet but thanks
>>
>>71384013
Oh thank you so much. I already have five years of experience I can put on my resume. What a relief. Unfortunately, I think I still might have to move out of state. All the openings I found are in Jersey or NC.
>>
>>71383808
Cute chino
>>
>>71383829
^ and @ are so much more aesthetic than * and &
>>
>>71383829
Anyone who thinks ^ and @ is more aesthetic than * and & have fucking shit taste and should never design a programming language ever.
>>
>>71384253
at least the @ symbol makes sense
>>
Was JavaScript (dare I say it) right? Are the only types you really need number, string, map/object, and list?
>>
>>71384238
They really are.
>>71384253
>TRIGGERED
>>
@71384281
It's ugly
>>
>>71384294
you only need true and false
>>
>>71384294
>Are the only types you really need number, string, map/object, and list?
no
>>
>>71384294
You only need tables.
Lua master race
>>
>>71383976
I've applied to more than 100 places with only a handful of interviews and no offers, and that's with a BS in EE and a year experience in embedded programming. The market fucking sucks if you're not "in".
>>
>>71384443
try a market that isnt embedded programming
>>
Figured out my GCC "bug" from the other day — turns out Clang executed argument statements in order, GCC didn't guarantee that. Don't know off the top of my head what the standard says, but this solution works for both compilers & is probably safer anyways.
>>
>>71384477
Order of argument evaluation is undefined in the standard, never depend on it.
>>
>>71384443
are there places where you believe you could add to their bottom line?
>>
>>71384477
>Order of evaluation of … function arguments in a function-call expression … is unspecified.
Well that answers that
>>
>>71384477
>standard doesn't say about order of argument evaluation in C++
no shit people have been shitposting about this in /dpt/ for like a year
>>
>>71384527
Yeah it typically doesn't even cross my mind because I usually put thought into interfaces, but I prefer keeping my unit tests terse so I'm more willing to use hacky code.
>>
>>71384477
kinda scary
>>
>>71384462
I did. Programming, PLC, hardware dev, analog research, even industrial machine operators. I got turned down from a logistic/inventory position for being too qualified (explicit reason). Only from one interview did I get feedback, and it was "you didn't wear a dress shirt". I was wearing a dress shirt.

>>71384531
Yes. The one job I had for a year I simplified their work cycle (it was very manual and error-prone before hand), implemented a back-up system and restored the lead developers computer after a hard drive failure, and wrote new features, besides isolating a bug that affected only the highest performance tier of our software. They stopped paying salary so I had to fucking walk out. I'm sure other people thought I just quit so I've since updated my resume to include unpaid salary as the reason I stopped working.
>>
>>71384477
Why are you using std::make_tuple? Are you stuck with pre-C++17 or something?
>>
>>71384477
HEY JOSEPH
>>
File: 1520364854884.jpg (28 KB, 482x565)
28 KB
28 KB JPG
>>71384562
You don't end up looking like this without seeing hell on earth that you created manifesting itself.
>>
>>71384612
That's a hold over from C.
>>
>>71384593
Yes, C++11 is the baseline for the library.

>>71384595
WHAT
>>
>>71383694
don't worry i figured it out.
>>
>>71384632
>C++11 is the baseline for the library.
Why?
>>
>>71384654
Why not? Nothing it's doing requires 17 features.
>>
>>71384583
I don't know what you're sending out now, but if you've just been sending out resumes and you're confident in your abilities, then I would start making more assertive sales pitches.
Send out attractive ads. Make follow-up calls.
Find some way to convince them they are missing out on your skills. Drill it into their heads that hiring you means they make more money.
>>
>>71384583
If they think you're overqualified to be an employee, they might see things differently if you portray yourself as a consultant.
Overqualified employees can leave, making them risky, but who's going to turn down an overqualified consultant?
>>
File: window.png (95 KB, 818x886)
95 KB
95 KB PNG
>What are you working on, /g/
Merged some changes, https://github.com/rootcoma/kxm still have about 10 things written down I want to work on. Time to nap then run some errands. The program is relatively stable and encrypted though, I am happy with how things are going so far.

I want to add a config file and parser, add a mode where moving the mouse to the side of a monitor can allow input forwarding to be toggled. First I need to finalize what my output format is going to be and what enums I will use for which keys.
>>
File: file.png (6 KB, 506x172)
6 KB
6 KB PNG
>>71384757
that's gonna be a yikes from me
>>
File: 1526842710733.jpg (108 KB, 1500x859)
108 KB
108 KB JPG
What would be an impressive program to create for an admin role? I was thinking something with webdriver and mlkit to automate data entry but I have nothing specific to do it against. Any ideas?
>>
>>71383061
Use constexpr instead.
>>
File: riuiw67b.png (4 KB, 200x200)
4 KB
4 KB PNG
>Good job on finishing this 300 page tutorial on learning the language features and writing our own algorithms, data structures and utility functions
>Oh and btw, you're not supposed to write your own algorithms, data structures and utility functions
>Consult the 600 page standard library reference manual to learn how to actually make anything useful :^)))))))))))))
How do I cope with having wasted my time?
>>
>>71384994
Learning and experience is never bad
>>
>>71383572
explain it smart guy
>>
File: sicpreadin.jpg (251 KB, 1280x853)
251 KB
251 KB JPG
>>71383032
NO!
>>
>>71385009
Mom will kick me out if I don't get a job by the end of summer, I need a good portfolio.
>>
What is the timezone code for real nigga hours?
>>
Today was my best day of work since getting into the industry
I finally did something that made the stark improvement in my abilities since I started extremely apparent
Got a meeting with the CEO tomorrow, gonna ask for more money

I'm goin all in, bois
>>
>>71385106
EST
>>
I have two job offers but one isn't in writing but sounds better what do I do. Problem is one of them is pushing me to respond before the first one says they will give me the offer. How should I buy time so I know for sure the first place will give me a real offer?
>>
>>71385083
and im sure the learning and experience of being homeless will make you a better person
>>
>>71383032
With a few simple fixes I've been able to reduce exception logging and useless error logging in our main service by about three orders of magnitude, and now our logs make much more sense and we can find interesting issues in them.
>>
>>71385386
>by about three orders of magnitude
Whoa! Numbers!
>>
>>71384994
You will encounter problems where the standard library isn't enough. Understanding how to build things yourself will prove essential.
>>
>>71383887
>in PA
Hey me too, I ended up going back to my uni and my adviser got me a research position since no one would take me. It's funny too since one of the projects we were working on we teamed up with a company and it was one i applied for and I knew the people and it was awkward as hell.
>>
>>71383887
>>71385617
Philadelphia here, post your resume and I'll read it in the morning.
>>
>>71383887
The applicant filter system they use is complete dog shit. You have to talk to a real person to have any luck your resume will probably just be tossed in the trash because it didn't have the right keywords.
>>
File: 1514225617837.jpg (20 KB, 285x365)
20 KB
20 KB JPG
>tell retard the code is c++
>tell him it's a warning of the C++ standard 2 fucking times and not an error
>he goes on to compile it with c99 standard to show that it works
wow good job retard
>>
>>71384593
whats the alternative to make_tuple?
>>
>>71385836
std::tuple
>>
>>71385836
i_makeuh_da_tuple
>>
>>71385836
std::boost::tuple_factory<std::boost::__experimental::boost::tuple_factory_flags::two>::instantiate.make_tuple(std::boost::tuple::tuple_arg<1>(a), std::boost::tuple::tuple_arg<2>(b))
>>
>>71386038
C++ taking inspiration from Java. Blessed boost.
>>
>>71385038
im proud of you
>>
File: 1538759723990.png (371 KB, 832x868)
371 KB
371 KB PNG
>>71383652
>>71383789
>that scream at the end
>>
File: Capture.png (45 KB, 823x684)
45 KB
45 KB PNG
Noob question here. I'm reading my C book and they are going over algorithms for data structs. What do the -> they use in this pseudocode mean?
>>
>>71386149
It's like the penis operator "=>" but only performs half the operation.
>>
>>71386149
ptr->member
is just a syntactic sugar for
(*ptr).member
.
Basically, it gets a struct/union member through a pointer.
>>
File: tenor.gif (3.01 MB, 302x300)
3.01 MB
3.01 MB GIF
>>71386159
....k
>>
>>71386169
is there any difference between whatever the fuck that arrow operator is called and the "." dot operator?
>>
>>71383061
>cpp
Couldn't have they thought of another name?
>>
>>71386205
The arrow works on a pointer. The dot works on a non-pointer. Otherwise no.
It certainly would be possible for them to make '.' just work on pointers too, but I'm not really sure of the reason that it there is a distinction between the two operators, but it's probably some ancient legacy reason. It's too late to change it now.
>>
>>71383061
>use constexpr
>waste my precious time and give it to subhuman end*sers

Yeah, nah dude
>>
File: keklul.jpg (98 KB, 1280x720)
98 KB
98 KB JPG
>>71385818
>ask how to compile something without getting irrelevant warnings to appease obsessive sperg brain
>get answer
>pretend to not be retarded while struggling through chapter 3 of babbys first c++ book
>>
>>71386053
Java has no tuples lol
>>
>>71386303
You missed the point entirely. Good going.
>>
File: 1559573693756.gif (33 KB, 388x394)
33 KB
33 KB GIF
How much thought do i need to put into an original virtual architecture design?

Am i in too deep if i'm thinking about bus contention and three-state logic? Is it even important to consider virtual bus architecture, or can i just pretend the buses don't exist and handle them transparently via the assignment and reference semantics of the underlying language?

For reference: i want to make an emulator for an imaginary 8-bit game system whose architecture specifics i am trying to make up from scratch.

Also how does three state logic even work?

I don't get it.

Okay, so from what I understand, 1 and 0 aren't actually on and off, 1 and 0 are just high and low but the circuit is always *on*, but then in three-state subcircuits you have 1, 0, and Z, and Z actually turns the subcircuit off. Do i have that right?

So if you think of a wire like a bit queue, you can dequeue 1s and 0s from it, but then Z is like if the queue is empty.

I think I understand that much. But then how the fuck does that WORK? How does the controller at the other end of the bus even test for a Z state, is the controller just turned off until it's swapped into the bus or something?

Also am i correct in my implicit assumption that the controller is what the bus leads to after data gets put on it?

Also, why would any architecture with a cache ever use DMA? Maybe it's just my misunderstanding, but it seems like the measures that would prove necessary to rectify resulting cache inconsistencies would make it less efficient than just routing everything through the cache to begin with.
>>
>>71386303
records are just tuples with named elements
objects are just records with poo overhead
so yes, java actually does have tuples, in fact it's based around them
>>
I'm taking digital animation lessons to make video games during my unemployment vacation.

I've an interview tomorrow. It's for a cybersecurity job position.
>>
>>71386291
>struggling
where'd you get that idea you fucking /v/ermin? I'm going through the exercises to document them, and I already mentioned everything that cannot be used, not because it's hard to understand but because that's how you'd do it if you were going through the book for the first time, fucking imbecile ape.
>get answer
And since it's a book about C++ why do you think it would matter what your C shit does? The standard forbids it. It'll still compile it but it's made clear that it's forbidden.
Fucking retard end your miserable life, you answered nothing
>>
>>71386291
imagine tolerating warnings in your code ever under any circumstances
>>
>>71386350
what did you expect of a cnile?
>>
>hacker news discussing my stuff again
>>
>>71386364
Hey now that we have figlet, what's the status on screenfetch?
>>
File: hitlerchan.jpg (905 KB, 1242x1817)
905 KB
905 KB JPG
Nothing important to say, I just wanna say thank you /dpt/ people for being helpful and helping a brainlet like me get through my CS classes. You guys are so much more helpful than stackoverflow people.
>>
>>71383652
Saved
>>
>>71386337
>>71386350
>>71386358
>>
>>71386384
sou nano ka
>>
>>71386375
Ayy I started making my own thing called retrofetch. I didn’t spend a lot of time on it yet though :)
https://github.com/SerenityOS/serenity/blob/master/Demos/RetroFetch/main.cpp
>>
>>71386414
While basic I'm actually impressed you also have all those control sequences implemented, that's very cool anon.
>>
already disproven yesterday, not even going to bother give him a (you)
const auto newSize = strlen(caA) + strlen(caB) + 1;
char caC[newSize];

ex03.40.cc:27:10: warning: ISO C++ forbids variable length array ‘caC’ [-Wvla]
27 | char caC[newSize];
>>
>>71386464
>We can't allow variable length arrays because MUH C
>But C has had variable length arrays for 20 years
>That's not REAL C
Is Bjarne autistic?
>>
>>71386464
I know you are upset with me but you don't have to be in denial and lie just to save face anon. Anyone with g++ can test my code and see that it works properly and generates no warnings even with all of your flag requirements. I wont be discussing this further as it has been solved. Good luck.
>>
someone plz give me an idea for a personal project that a first year cs brainlet can do.
much appreciated
>>
Quick brainlet question
Can TCP work like
> out
> out
< in
< in

Or strictly
> out
< in
> out
< in
>>
>>71386660
implement a self-resizing serializable hash table and a shell to interact with serialized instances of it
>>
>>71386677
Neither. It's full duplex. You can send or receive messages whenever. Design any type of protocol.
>>
>>71386677
it can be
> out
> out
if it has to re-transmit lol
>>
>>71386693
think he might be talking about the ACKs but he might just not understand the topic fully
>>
>>71386678
something a bit friendlier? ;_;
>>
imagine being a mentally ill cnile /pol/tard and using outdated shit or purposely skewing his test just to win an internet argument lmao
>b-but everyone can compile my code and see!
yea they sure fucking can
https://godbolt.org/z/WCegRf
https://godbolt.org/z/UiSs7C
https://godbolt.org/z/GDqWtv

maybe you should stop browsing /v/ and /pol/ and try to use tools made in this century
>>
>>71386660
Blackjack
>>
>>71386703
ACKs are verification. Doesn't change what I said.
>>
>>71386713
maybe a data structure of your choice, perhaps a simpler one, that need not be serializable, and a shell to interact with it in memory?
>>
>>71386500
and he's right. 20 years ago they had different problems and certain solutions for it, that doesn't mean those apply today and that you should keep doing it the same way
nobody is forcing you to follow iso cpp, at least for now
>>
File: gWr51.png (22 KB, 353x474)
22 KB
22 KB PNG
>>71386703
This is the case. In HTTP you can do this pipelining. I am wondering if something like this is also done when it comes to the ACK's or however it works in TCP
>>
>>71386744
>I am wondering if something like this is also done when it comes to the ACK's or however it works in TCP
I'm a bit rusty with my TCP knowledge, but you can send multiple packets and receive one ACK back for all of them.
>>
>>71386744
That's done over TCP. See >>71386724

There is no need for sent message to have any structural resemblance to the received messages. The socket is full duplex and you can send as many messages as you want whenever you want. In the case of chunked transfer encoding, a single HTTP response might be sent as 20 different packets. TCP handles the packet layer so you don't have to, making it possible to send data whenever. You design the protocol, and server/client model is certainly not the only way to design one.
>>
>>71383479
Wasn't there some really stupid bug with some windows developer targeting windows 98 and 95 specifically in their code and then they got fucked hard with windows 9?
>>
>>71386677
Why are you asking? Are you wondering about order guarantees?
>>
what is the best way to learn c? i want to get ahead for next semester.
i learned python on my own but this shit seems 100x harder wtf
>>
>>71386961
>what is the best way to learn X
use X
>>
>>71386500
>needing VLAs
#include <iterator>
#include <cstring>

int main () {
const char x[] = "foo";
const char y[] = "bar";
char z[std::size(x) + std::size(y) - 1];
strcpy(z, x);
strcat(z, y);
puts(z);
return 0;
}
>>
>>71386968
<source>:7:17: error: 'size' is not a member of 'std'; did you mean 'size_t'?

7 | char z[std::size(x) + std::size(y) - 1];

| ^~~~

| size_t

<source>:7:32: error: 'size' is not a member of 'std'; did you mean 'size_t'?

7 | char z[std::size(x) + std::size(y) - 1];

| ^~~~

| size_t

<source>:8:12: error: 'z' was not declared in this scope

8 | strcpy(z, x);

| ^
>>
>>71386968
Those are not variable length, those are all known at compile time
>>
>>71383652
Is this what a mental meltdown sounds like?
>>
>>71386500
Stop dirtying the name of autists.
It's getting ridiculous.
>>
>/dpt/ arguing about stupid shit as usual
>meanwhile I'm writing a constexpr C interpreter and later compiler
feels good not to be retarded
>>
>>71387003
https://godbolt.org/z/ya_1ba

>>71387020
That's the point. Either the length of your stack buffers is known and bounded, or you should not be putting that shit on the stack.
>>
>>71387111
>not writing everything in c++11
but regardless, that's nice
>>
>>71386500
No VLAs were a mistake and C11 downgraded them to an optional feature.
>>
>>71387111
>That's the point. Either the length of your stack buffers is known and bounded, or you should not be putting that shit on the stack.
Arena allocators do just this with alloc to improve performance.
>>
>>71387162
In that case it's fine, since the buffer is bounded by the maximum size allowed on the stack by the allocator.
>>
alloca > VLAs
>>
>>71387284
I don't usually use alloca.
But I know sepples programmers speak of that function with great fear.
Why? Is it that leaking a stack pointer and corrupting stack memory is a hard bug to catch?
I don't see how that could be. So there must be some other explanation.
>>
>>71387304
Stack corruption made me spend two weeks tracking random behaviour because a shithead at work thought he was too good for malloc.
It was particularly bad since it was an embedded device without MMU on an RTOS.
>>
>>71387342
What did he do that made him too good for malloc?
>>
>>71383887
Live in a love income country
That's how I did it ;^)
>>
>>71387342
Can't you just look at all the pointers in your program and see which point to the stack? Should be easy to tell since that of problem can only be introduced if you're pointing to stack memory outside the current callstack. I suppose that's a little bit harder on an embedded platform but seems entirely reasonable still. It obviously catches bugs not associated with alloca as well. Point is that it's something you can automate.
>>
>>71387304
There's no guarantees that it won't blow out your stack. Threads on Linux generally have an auto-extending stack which is guarded by at least one PROT_NONE page at the bottom, but if your stack allocation is dependent on user input you can craft a malicious situation where that guard area is jumped over, in some situations even in a 64-bit address space.
https://lwn.net/Articles/725832/
For small deterministic amounts of storage, you are probably already using local arrays/containers as usual.
>>
>>71387433
Probably used alloca
>>
>>71387451
Thanks. Just what I was looking for.
>>
>>71384994
Knowing how things you use are built can be very useful
I always favoured bottom up learning
>>
>>71383887
companies shilled too hard and everyone jumped on the bandwagon so now we're all fucked
>>
>>71387519
>too hard
They knew exactly what they were doing, now they can pay less for the same work because there is always 10 other people who'd gladly take your position for a smaller pay
>>
File: 3333.jpg (42 KB, 552x339)
42 KB
42 KB JPG
>>71387649
>now they can pay less
not if they want quality
>>
>>71383227
anime
>>
>>71383828
Is that true? I remember the variable FoV blog post that discussed the impact it had on other areas of the game.
>>
>>71387663
The notion of "software quality" doesn't really exists above engineering manager positions
Higher ups, just see more people -> more productivity
Also even if it's not directly proportional, with the growth of the "talent" pool, the number of actually talented developers grows as well
>>
File: ploot confus.png (322 KB, 430x430)
322 KB
322 KB PNG
What's the difference between compiling C under C++ and using a real C compiler?
>>
>>71383227
free range liver
>>
>>71387826
There's some weird shit you can do that'll work in a C compiler but not in a C++ compiler.
>>
>>71387796
>with the growth of the "talent" pool, the number of actually talented developers grows as well
lol
all the high IQ people who could do it well were already in the pool
it's just literal shit pouring in now
>>
>>71387852
like what?
>>
>>71383808
You don´t really need math for that.
If you are just starting, don´t care about math yet. Math is for more advanced programming.
Good luck.
>>
>>71387826
chad vs virgin
>>
>>71383829
Pascal put the HUMAN READABLE into human readable programming language.
>>
>>71387901
which one is the chad?
>>
Anyone got some some really simple issues on GitHub that need fixing? I'm new and want to fix a real life problem but I'm scared of the big repos.
>>
>>71387973
https://up-for-grabs.net/#/
https://www.firsttimersonly.com/
https://github.com/topics/good-first-issue
>>
>>71387973
contribute to the repo of a software you use
>>
>>71385009
Not him, but not true. Learning pointless shit is worse than not learning at all, as it's a waste of time and energy.
>>
>>71387826
Compiling C as C++ is completely fucking retarded. They are not the same language, and anything but the most simple and contrived code is not going to work.
>>
>>71388034
but whats the actual difference? what code won't work? barring c11 things like generics
>>
File: 78122044a9ad0d15.jpg (473 KB, 707x1000)
473 KB
473 KB JPG
>>71387869
>IQ isn't normally distributed
>>
>>71388059
It is. And programming already filtered out the highest parts.
>>
>>71388043
int *ptr = malloc(sizeof *int);
>>
>>71386264
BASED
>>
>>71388083
>sizeof *int
sizeof *ptr I mean.
>>
>>71388068
>It is.
why are you contradicting yourself
>>
>>71388083
that seems like it's perfectly valid in c++
>>
>>71388111
if you have a distribution of values, you select for values above X, then you want to expand your selection. what do you get?

You get more values below X.
>>
>>71387878
Mostly things that a C compiler with warnings turned on will remind you of, including the requirement for function prototypes, stricter type checking (e.g. non-const pointer to const storage, need to cast void* pointers) and of course using C++ reserved keywords as variable names.
https://isocpp.org/wiki/faq/big-picture#back-compat-with-c
>>
>>71388120
Except new people ate born each year.
New people join the total pool each year.
Are they not normally distributed maybe?
>>
File: dva maga.jpg (108 KB, 850x910)
108 KB
108 KB JPG
https://www.radford.edu/ibarland/Manifestoes/whyC++isBad.shtml
>>
To my surprise almost everyone working in AI doesn't actually know much of the underlying principles and mathematics. For instance, in games, not many people could tell you how even a simple minimax algorithm works, and in machine learning, virtually nobody knows how a neural network is actually implemented.

I'm not sure whether it's a good or bad thing that people are calling themselves "engineers" but just use high level engines and libraries.
>>
>>71388138
that article just made me think of an rng that works by grabbing arbitrary memory locations and casting them as uints.
>>
>>71388165
Ah, the OpenSSL approach of using uninitialized memory as an entropy source.
>>
>>71388158
minimax is only useful for simple board games
machine learning isn't useful at all

you're a software "engineer" the same way a garbage man is a waste management "engineer". just a feel good euphemism for code monkey.
>>
>>71388112
void* are not implicitly converted to typed pointers in C++.
>>
>>71388188
okay so it's just autism
>>
File: XlvmPXy.png (372 KB, 536x628)
372 KB
372 KB PNG
only ~900 pages to go
>>
>>71388138
>Object-oriented programming (the “++” part of “C++”)
hmmmmmmmm
>>
>>71388193
well no standard C idioms literally don't work in C++
casting malloc is a bad thing in C, you shouldn't do it
>>
>>71388138
>worthless academic's opinion
Why do people care about some bumfuck who's never worked on anything important?
>>
>>71388202
of?
>>
>>71388158
thats because AI is a meme
>>
>>71388254
c++ primer
>>
>>71388138
>/v/-toddler
>>
>>71388265
nice
>>
>>71384795
Nice catch. At least it's not a magic number. I am going to need to move that to the top and rename it.
>>
>>71388241
using non-null terminated strings is considered bad in C too...
>>
why even use macros for constants, that's so stupid...
just annote a variable as const and let the compiler do constant folding
>>
>>71388184
I don't know why I bother replying to literal 14 year olds with zero reading comprehension. Do you not see that I purposely chose simple concepts like minimax to illustrate a point? I would recommend that you stop programming and learn how to read English first.
>>
>>71388295
non-null terminated strings. Not to argue semantics, but I am fairly sure the definition of a "c string" is an array of characters that is proceeded by a null byte '\0'. An array of char type is not necessarily a string, but now you have you track the size of your array and cannot use functions that depends on your char array being a "c string".

>>71388285
>>71384795
Also, this is a feature I am testing on that I shouldn't have pushed to master but it was on the branch I was working on and I added it, so it is what it is for now. I am planning to implement the so that my program can work windows->windows windows->linux linux->windows and linux->linux. I was messing around one night with trying to get keyboard and mouse events and those were some helper functions.
>>
File: communist-tan-new.png (163 KB, 300x440)
163 KB
163 KB PNG
http://www.talisman.org/~erlkonig/misc/oopbad/
>why oop reminds me of communism
http://www.softpanorama.org/SE/anti_oo.shtml
>Both communism and OOP rely on the concept of classes. Both generate a lot of fanaticism and overuse this notion.
>>
>>71388313
C doesn't have actual symbolic constants. Womp womp.
>>
>>71388386
why would I take seriously the opinion of someone who makes a webpage that looks like that
>>
FUCK

Is there a standard formula for position of an object that rebounds off something?

I'm trying to figure out whether its possible to create a mathematical solution that determines the position of multiple particles that can collide.
>>
>>71388403
all serious web pages look like that
>>
How do I know in Java when a function alters the variable that I pass, and when it creates a new one?
>>
>>71388406
It depends on elasticity. But all no energy can be lost, (in the real world there is drag, stickiness, heat generated and lots of things), but you can assume that a rebound of two objects is going to impart energy relative to the mass and velocity of each object in a tangent vector. Just figure it out.
>>
>>71388414
lol, "serious" web pages huh
>>
>>71388418
Learn to pass by reference vs pass by value.

>>71388402
const int CONSTANT = 2;

void foo(void)
{
CONSTANT = 3; // will not compile
}


?
>>
>>71388418
In C++ you have const correctness.

In Java you're just fucked.
>>
>>71388406
>Is there a standard formula for position of an object that rebounds off something?
you need to be alot more specific than that
>>
>>71388427
>But all no energy can be lost
Meant to imply that all energy must be conserved.
>>
>>71388430
Without inline-like semantics this is extremely limiting.
>>
>In the beginning, there was spaghetti code.

>And Dijkstra said, ‘Let there be Structured Programming! Thou shalt consider goto harmful and organize your code into functions with proper control flow mechanisms.’

>And programmers said, ‘OK, sure we’ll do that.’

>Then Dijkstra saw that code was still spaghetti and said, ‘Stop sharing state willy-nilly! Thou shalt avoid global variables and instead pass all state through the call graph.’

>And programmers said, ‘Er, um, wait, really? We haven’t really figured out this functional programming thing, nor do we want to pay the overhead of immutable data on today’s machines, so what you’re proposing is horribly impractical and inconvenient for non-trivial programs.’

>But the programmers did agree that shared state is problematic and that maybe they could cut back on all these global variables.

>And so Object-Oriented Programming was born, and the global variables lived happily ever after disguised as singleton object fields.
>>
>>71388455
>Without inline-like semantics this is extremely limiting.
In what way?
>>
>>71388457
lol, I kek'd
>>
>>71388430
sepples friends can do things like this, which won't compile in C

int main()
{
const int len = 5;

int sepplesArray[len] = { 0, 1, 2, 3, 4, };

return 0;
}
>>
>>71388459
because you generally want such constants in headers
>>
>>71388430
I understand the difference (Java is all pass by value) but I mean in practice is there a quick way of knowing whether a function alters a value? I noticed lists, for example, don't create new lists when you add a value, they just return true/false and amend the list itself.
>>
>>71388487
No, you just have to check the documentation.
>>
>>71388486
>because you generally want such constants in headers
And you can?

header.h
#ifndef __INCLUSION_GUARD_H
#define __INCLUSION_GUARD_H

// Extern constant
extern const int CONSTANT;

// Alternatively use an enum for flags and multiple values
enum /* anonymous if C99 or a named type if you need type */ {
CONSTANT = 3,
SOME_OTHER_CONSTANT = CONSTANT + 3
};

#endif


???

>>71388487
No. But you can add final modifiers to function signature to indicate that you're changing the object.
>>
>>71388522
>extern
now you've removed the motivation for it to be constant, because it won't be folded!
>enum
the best solution for symbolic constants in C, but crippled to only support int
>>
>>71388522
Just pass that CONSTANT over https using json asynchronysly. It will be fast enough.
>>
>>71388386
>C++ is communist
Correct.
https://youtu.be/3TwEaRZ4H3w?t=466
>>71388429
Yes, all of them.
https://www.agner.org/optimize/
This is one of the best software optimization resources I know and it has a sarcastic
animation in it.
If it looks sort of OK take it with a big grain of salt. Choke on it.
>>
>>71388541
Using UTF-8 of course.
>>
>>71388540
>now you've removed the motivation for it to be constant, because it won't be folded!
Well, that's why people use defines. But you can also declare it static in the header, but that's a dirty hack.

#ifndef __INCLUSION_GUARD_H
#define __INCLUSION_GUARD_H

// Static will ensure that it is folded/inlined for each compilation unit, but will yield a "unused variable warning" if not used within the compilation unit
static const int CONSTANT = 3;
>>
>>71388577
Gross. There's a much cleaner language hiding under both C and C++.
>>
>>71388588
Nobody claimed C is a pretty language.
>>
>>71388441
Is there a formula for final displacement in 1D after two objects of the same mass collide going different velocities?

>>71388445
Momentum is conserved but if I assume all collisions are purely elastic then kinetic energy is conserved too.
>>
File: anima.gif (5 KB, 419x125)
5 KB
5 KB GIF
>>71388542
based
>>
Do all terminals on all platforms end with Control C or do I have to have specific instructions for Windows/Mac/BSD/tmux/whatever users?
>>
>>71388605
>Is there a formula for final displacement in 1D after two objects of the same mass collide going different velocities?
there is a formula for the change in velocities of the two objects, there isn't a formula for displacement because that doesnt make sense
you're modelling physics in discrete timesteps, thats not how it works irl
>>
>>71388632
https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts#Command_line_shortcuts
>>
>>71383340
you're passing by value, not by reference.
>>
tfw cleaning my desk
>found 5 microSD adapter
>3 microSD cards
>a raspberry pi zero
>4G of ddr3-l ram
>a few usb flashdrives
>random electronic components
>>
>>71388704
Discrete timesteps?
No. I am looking for a formula as a function of time. Obviously there are generic solutions using delta t between updates.

I'm wondering if there is a single, general function (albeit complex) that models the displacement of a particle given non-uniform velocity if you have the initial state of all particles in the system.
>>
>>71388857
>I'm wondering if there is a single, general function (albeit complex) that models the displacement of a particle given non-uniform velocity if you have the initial state of all particles in the system.
there isn't
that's an incredibly broad question with a million answers
there's many types of particle simulations for many different kind of particles
you have sand simulation. cloth simulation, fluid simulation, particles used to simulate solid bodies
>>
File: IMG_20190327_180009.jpg (89 KB, 1938x1102)
89 KB
89 KB JPG
>In theory, RNNs are absolutely capable of handling such “long-term dependencies.” A human could carefully pick parameters for them to solve toy problems of this form. Sadly, in practice, RNNs don’t seem to be able to learn them. The problem was explored in depth by Hochreiter (1991) [German] and Bengio, et al. (1994), who found some pretty fundamental reasons why it might be difficult.
>proceeds to link a 74 pages long book
AAAAAAAAAAAAAA
why is learning about something so hard in this field, everything leads to a new subject
>>
>>71388605
depends on the type of collision you want. The simplest to model is this https://en.wikipedia.org/wiki/Elastic_collision
You can compute the position of the two objects for any time t with the formula. If you need to display the objects you'll need a discrete timestep and compute the result for
t0 + n * dt

where t0 is the initial time
dt is your constant timestep (use(1/60) for 60 update per seconds)
n is the current frame

This isn't practical at all if you have multiple objects that will collide. You'll need to use some kind of imperfect solver for this for any realtime application
>>
>>71386336
k keep me posted
>>
>>71388857
displacement can be described as velocity over time. so you need to get the velocities, get the exact time of collision, get the exact time of your desired result, and then you can do velocity over time to get the position
>>
File: 1559937201204.jpg (100 KB, 600x600)
100 KB
100 KB JPG
You are forced for the rest of your life to use only two (2) programming languages.

What do you choose and why?
>>
>>71389158
html and xhtml because they are the future
>>
>>71389158
c++ and lua
because they're the cutest couple
>>
>>71389158
C++
>>
>>71389158
C and POSIX shell.
>>
>>71389158
Ruby - I can do almost anything with this unless it's low level stuff
C - For the low level stuff
>>
>>71389187
only gives 1 language

>>71389220
doesn't give a why

Anon's, your reading comprehension is commendable.
>>
File: 70202726_p0.png (1.39 MB, 1168x965)
1.39 MB
1.39 MB PNG
>>71389234
I don't feel like elaborating why. If you don't already know, you wouldn't understand.
>>
>>71389158
C cause performance and close to metal
Python cause comfort and fast scripting
>>
Why can't more companies hire like this?

>Rather than your work history, educational background, Github pages, Twitter profile, or your ability to write code on a whiteboard, we’re interested in your aptitude and enthusiasm for the problems we work on. The way we figure that out is with work-sample tests.

latacora.com/careers/
>>
>>71389158
Cpp and common lisp
>>
>>71389345
>close to the metal
https://queue.acm.org/detail.cfm?id=3212479
>>
>>71389158
rust and python because they're inclusive and safe
>>
>>71389353
Really make you feel like you'd like to work for them.
>>
>>71388402
wtf why even use this trash lang then
>>
File: 1560312447857.png (16 KB, 274x301)
16 KB
16 KB PNG
>>71389355
All of these languages to pick from, and you go for the C preprocessor?
I mean, it's not even Turing complete.
>>
>>71389377
You can thank AT&T for shilling it to no end in the 70s.
>>
New thread:
>>71389415
>>71389415
>>71389415
>>
File: 4c933a7b0597dac0.jpg (165 KB, 549x721)
165 KB
165 KB JPG
>>71389158
sepples and haskell
>>
Why does every fucking faggot have to invent their own cryptography?
>>
>>71383808

this

https://archive.org/details/WhatIsMathematics
>>
>>71383887

WE. ARE. FULL.
>>
>>71389441

this nigga basically gets it. C/C++ and Haskell, I would say



Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.