[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: 1541532591349.png (559 KB, 821x3109)
559 KB
559 KB PNG
Old thread: >>70561898

What are you working on, /g/?
>>
>>70568341
god i wish that were me
>>
>>70568385
You want to be a traumatized little girl?
>>
Design patterns are possibly the single biggest snake oil ever marketed in software development.
>>
>>70568341
im working on finding out where i start learning how 2 code

any tips
>>
>>70568396
if she's got poptarts, sure
>>
>>70568436
Just pick a language and start. Follow some simple tutorials and maybe copy some other people's examples and tweak them until you understand them.
>>
C noob question here.

I'm going through step by step trying to make a function that will do calculations with each element in my array. My array needs to be filled with numbers it gets from a txt file. Before I go through building my function I just wanted to make sure my arrays were filling properly with my end file loop so I wrote the printf statement in my EOF loop.

Why is it that this loop only prints one thing at a time and makes me hit enter in order for it to get the next thing? Did it fill the cells of the array properly or is it only filling the cells everytime i hit enter?
int main()
{
int day, month, id, i=1;
char c;
double hours_used;
int id_array[10];
double charges_array[10];
double cost;
FILE*infile = fopen("usage.txt", "r");
FILE*outfile = fopen("charges.txt", "w");

fscanf(infile, "%d %d", &day, &month);
printf("day: %d month: %d\n", day, month);

while ((c = getchar()) != EOF)
{
fscanf(infile, "%d %lf", &id, &hours_used);
id_array[i] = id;
charges_array[i] = hours_used;

printf("ID: %d hours used: %lf\n", id_array[i], charges_array[i]);

i++;
}
>>
>>70568341
Those cords are dangling all over the kitchen xor that is a fucking powerful toaster
>>
>>70568466
Your while loop is being driven by a getchar, meaning it's only going to run when you enter something on stdin.
while (fscanf(infile, "%d %lf", &id, &hours_used) == 2) {
id_array[i] = id;
// etc
}

is actually what you're looking for.
>>
>>70568436
Do a C++ course on Alison or edx or one of those
It's not a perfect language but it's got a good spread of high and low level features that come in handy when you move on to other languages. Plus it's a good base for learning syntax, whenever I encounter a new language I always find myself comparing/contrasting how it's written with C++.
C++: it's OK, and that's OK
>>
File: 1553904528422.gif (700 KB, 245x165)
700 KB
700 KB GIF
>>70568341
Help me /g/ I started learning C++ (my first time into programing), and everything was doing fine, until they start throwing a lot of things that have no use, at least for now.

Any tips/videos for the absolute begginer?
>>
>>70568524
>until they start throwing a lot of things that have no use, at least for now.
like what?
>>
>>70568466
Every time you call getchar() it wants to get a char

hitting enter presumably gives it a NULL
>>
>>70568442
too bad, she only has toast
>>
>>70568524
>they start throwing a lot of things that have no use
I don't understand this concept. If you can write it you can use it?
>>
>>70568527
classes/structs

:^)
>>
I wrote some javascript to let credit karma's 1099-B tax form to load a CSV so I didn't have to enter it manually.

https://gist.github.com/wizpig64/d0ec4e5bb3735ffe47b7c22ba5d2a91c
>>
>>70568524
Just use C++ like C with classes.
>>
>>70568551
Did you have enough transactions to save you some time?
>>
>>70568513
>>70568529
thank you guys
>>
What are some habits you bring from others languages /g/?

>Java classes
I lit make a class for almost everything, i can take that habit out of me.
>>
>>70568585
I implemented linq in a C++ project I was maintaining alone. Too fucking bad I can't has linq expressions or queries though
>>
tfw your code gets cluttered by error handling for scenarios that practically wont happen
>>
>>70568524
Learn C first, then move to C++. C++ has so much goddamn shit in it that stroustrup himself probably doesn't have a complete working knowledge of it anymore. Every tutorial or book will send you careening into some rabbit hole and you'll never understand what the fuck is happening.
>>
*meows*

I understand why C++ Constraints and Concepts is useful but also this language is truly off the rails
https://en.cppreference.com/w/cpp/language/constraints
>>
>>70568563
I probably spent 2 hours on it and could have entered the 60 lines in less than half the time.

But:

1. Hand-entering numbers (and text!) from one spreadsheet into another takes me to a dark place that I don't want to go.
2. I can re-use this next year assuming nothing changes.
3. I can show it to credit karma and demand they hire me.
4. I still submitted before the end of tax day.
>>
>>70568653
now we just have to wait for C++20 to be implemented in compilers
>>
Working on a Python project in college, but I'm stuck. I'm brand new to Python and trying to learn it so I don't fail this class. Any good resources to look at?
>>
Can I get a good book/tutorial/primer on databases? I am doing a quiz program and I need to save user data, and it seems like a good time to delve into this subject. If I need to go really deep, that's fine. I'll probably need to be competent at databases anyway.
>>
>>70568767
https://docs.python.org/3/
>>
>>70568788
>If I need to go really deep
In databases, """deeeep""" means multiple instances, maybe in multiple geographies.
They're otherwise entirely uncomplicated and you shouldn't think too hard about it unless your performance is impacted by your shit design.
>>
>>70568436
I'm new myself. After many false starts over the years I finally decided it wasn't gay if I sucked a dick, and I took a class at the community college.

I lucked out and got a great instructor. The first few weeks were really tough, but the learning curve leveled off a bit and I really got into it. Aced the class and now I've almost completed the text book on my own. The pace of the class actually started slowing me down and I'm doing really well on my own. Already started learning C because I get sick of the pedantry of the c++ textbook.

So I'd recommend taking a class. Or the online course the other anon suggested. You could even just get a book or textbook. Check the wiki.

Even though I only know a little c++ and even less C, C++ does seem like a good place to start. It is ubiquitous and does anything you want it to. I think?
>>
>>70568456

This is the advice that kept me from actually learning 2 kode for over 10 years. The learning curve is really steep at the beginning. Having some hand-holding through the first phase is really helpful.

Fuck you and your shitty advice.
>>
How would you quantify the skill level of some programmer? It's this thing where you have a feeling of it, but I can't really think up a way to put it as a number or something.
>>
>>70568436
>>70568839
The first reply was right. Your first language is completely irrelevant because both in (category) theory and in practice, all popular languages are converging to the same featuresets.

After you learn how to write the same sets of algorithms and data structures in your third language, they will all start to blend together.
>>
>>70568815
Do you think 7 weeks is enough time to become fairly well-versed in Python? I've taken 2 classes that use Matlab, and am in a third one now, and I still have to look up how to do everything I want to do.
>>
>>70568529
Wait, doesn't hitting enter give it a '\n'?
>>
>>70568341
>What are you working on, /g/?
For school, Python.
For me, OCaml.
>>
>>70568849
Uh, maybe people learn differently? The way I wrote is exactly how I initially learned, by copying examples out of the C++ for Dummies book when I was 13.

Alternatively, maybe you're just retarded.
>>
>>70568864
MATLAB is an abomination of a language that tries to appeal to autistic mathfags (1-based iterators :DDD) but is actually still imperative.
It is little wonder you are still looking things up for a language that explicitly tries to be a special snowflake.
A language designed to be used by actual human beings is easier to understand.
>>
>>70568820
I literally know nothing about them. I've never used one. I know SQL is a database language.

The best I could do with my knowledge is have my program output a text file with the data and retrieve it during a new instance. Should I just go with that? Is that a database?
>>
>>70568863
My main point is that canard of "just pick a language and learn it" is shit and misses the point.

Most online tutorials are sparse and crap. I found it really useful to have a structured approach. A good textbook and even an instructor was really helpful for me.

Also, just picking a language is not really feasible to a complete n00b. You don't know what's what and how to compare. I personally am really glad I started with C++ and not Javascript or even Python.
>>
>>70568892
Well, when it comes to coding, I'm fucking retarded. I'm better than some other people in my classes, but nowhere near the best. Python seems somewhat more intuitive, but if I'm not using print or plot or writing equations, I'm lost.
>>
What are some benefits of using C++ over C when using it to program more C-like code?
Genuinely considering dabbling with it a little.
>>
>>70568900
Are you interested in understanding why databases are designed the way they are, or do you just want to use them?
>>
>>70568849
Well, there you go. You had a BOOK. A BOOK designed for beginners. Which is my point. Just telling someone to pick a language and learn it doesn't intrinsically include the vital aspect there which is GET A BOOK.

You're the one who needed a book for literal Dummies, so maybe the retard is YOU. *burn*
>>
>>70568928
It instantly alienates the much better pool of C programmers from contributing to your program, and leaves you with the shit-eating scraps.
>>
>>70568880
>Well, there you go. You had a BOOK. A BOOK designed for beginners. Which is my point. Just telling someone to pick a language and learn it doesn't intrinsically include the vital aspect there which is GET A BOOK.
>You're the one who needed a book for literal Dummies, so maybe the retard is YOU. *burn*

*responded to my original post accidentallylike. I guess i am the tard.
>>
>>70568947
But anyone can just surround their contribution with
extern "C" { ... }
if they really needed to, couldn't they?
>>
>>70568947
>the much better pool of C programmers
Is this true, and if so, why?
>>
>>70568931
I'm interested in being relatively competent with databases. I am a n00b to all of this, and I'm finding that it suits me to really learn a subject I'm interested in.

I'm going to be needing them with some of the projects I have in mind, so I might as well know what they're all about.
>>
>>70568954
>>70568943
Dude, why are you sperging out? Go back and read my original post where I mention "simple tutorials."
Calm down, have a nice hot cup of tea or something, and work on your reading comprehension.
(And stop writing *burn* and random capitalized words like a pre-teen forum user in 2008, it's a bad look)
>>
>>70568928
Pros:
Some nice features of C++ that really should have been in C11

Cons:
RAII is fucking retarded and nothing will work in any way you expect until you wrap everything with extern "C" because C++ is retarded
>>
>>70568995
Imagine not being able to comprehend the simple elegance of RAII
>>
>>70568969
Well, when you figure out the answer to that question, if you want to understand why people use databases and why databases are designed the way they are, then just read this book
https://www.oreilly.com/library/view/designing-data-intensive-applications/9781491903063/

If you want to just use a database, then I'll cut to the chase and tell you to download Postgresql and follow their tutorial. http://www.postgresqltutorial.com/

But lastly, SQL is called a declarative language. In declarative languages, you define facts and are effectively just telling the computer to "give me what I asked for." Markup languages like HTML are also declarative languages.
>>
>>70568980
Concise tutorials are exactly the problem. They suck. They're not helpful.

K&R is concise but it's actually really good. It's a joy to read and it pretty much gives you all the information you need to learn the concepts. Most online tutorials are written by actual spergs who have no sense of pedagogy or basic humanity.
>>
>>70568995
>RAII is fucking retarded
std::unique_ptr<T> is good enough for 99% of cases of memory management
>>
>still using old as fuck C++17 in twenty fucking nineteen when C++2a exists
fucking luddites
>>
>>70569014
Interesting. Thank you very much.
>>
>>70568676
GCC already implements half of C++20 and it's not even 2020 yet.
https://gcc.gnu.org/projects/cxx-status.html
>>
>>70569034
This language is so freaking huge already and it's only getting worse
>>
>>70569064
lmao fucking brainlet.
C++ isn't big enough yet, it still needs a lot more features.
>>
>>70568921
>>70568921
>I personally am really glad I started with C++ and not Javascript or even Python.
Certainly there are benefits to learning from a particular language... learning from Javascript will place you in the hotpot together with bootcamp ``koderz'', compilers, businessmen abusing SEO, retards, and data """scientists"""

But what you're supposed to understand from the statement I made is that once you learn how to do something in another language, because its syntax and quirks forces the entire community to do something different, you will find a similar way of doing things in languages you've learned before.
Maybe those other ways are better. Maybe if you started in Javascript and moved onto C# or Python you would learn how fucking retarded javascript programmers really are. But you wouldn't really be any worse off for it.
>>
What are some good projects written in C++ that represent everything that's good about the language?
>>
>>70569064
C++ is what happens when people who sit in academia theorizing about languages get to design one. Haskell is the same way but at least Haskell is driven by proofs rather than "wouldnt it be neat if"
>>
>>70569133
Perhaps the web browsers
>>
Best way to learn Java? I learned other languages like python just from fucking around, but have to take a Java class in the Fall and want the basics of the language down
>>
File: 1546322940144.gif (150 KB, 849x458)
150 KB
150 KB GIF
>>70569183
Do the needful and learn the java
>>
>>70569183
take a vacation to india
bathe in the waters
absorb the essence of java
then you will truly have done the needful.
>>
>>70569147
you don't know what you're talking about
>>
File: 1539813386350.png (104 KB, 792x1023)
104 KB
104 KB PNG
>>70568436
K&R. Used by programmers for generations, never once failed me.
Good basics applicable everywhere.
When you got that down, you could try doing some smaller projects of your own. When you feel like you're ready to go on to the next level, read TAOCP.
>>
>>70569252
Shut up faggot
>>
File: zorder.png (858 KB, 1920x1200)
858 KB
858 KB PNG
Making it possible to change the z-order of widgets in my operating system, and hooking it all up in the interface builder.
I spent the day chasing down excessive kernel heap traffic so it's nice to be back to some GUI programming.
>>
File: 1523965950078.png (292 KB, 873x493)
292 KB
292 KB PNG
>>70569198
What's the deal with his shirt?
>>
When you make pure interfaces in C++, is it bad to not make constructors and destructors? What about empty destructors for normal classes, what is the view on that?
>>
>>70569338
he's in india and temperatures are regularly 90F over there
>>
>>70569338
How else are you going to learn how to create a class with 1100 members?
>>
>>70569338
If you don't get this sweaty then you simply aren't programming hard enough
>>
>>70569359
They don't have air conditioning?
>>
>>70569405
air conditioning and its consequences have been a disaster for the human race
>>
>>70569333
This is the new Linux :)
>>
File: 1479956234614.gif (1.96 MB, 400x225)
1.96 MB
1.96 MB GIF
>>70569405
>indians
>affording things
>>
>>70569411
>indians
>humans
>>
>>70569453
yes, indians are a subspecies of human
>>
>>70569465
a species of subhumans*
>>
>>70569333
i never thought i'd hear the phrase, "it's nice to be back to some GUI programming"
>>
File: 1554598616344.jpg (1.08 MB, 2448x3264)
1.08 MB
1.08 MB JPG
Is there a better way of printing ascii art rather than going:

 1 #include <iostream>
2 using namespace std;
3
4
5 void pyramid(){
6
7 cout << " $$$$$$$" << endl;
8 cout << " $$$$$$$$$" << endl;
9 cout << " $$$$$$$$$$$" << endl;
10 cout << "$$$$$$$$$$$$$" << endl;
11 }
12
13 int main()
14 {
15 pyramid();
16 }



Can't I do that without calling cout 4 times?
>>
>>70569147
>"wouldnt it be neat if"
>implying that isn't the best way to design things
>>
>>70569491
you could remove the "; cout" but it's still dumb
>>
>>70569491
for (int i = 1; i <= 10; i++) {
for (int j = 1; j<= i; j++)
cout << "$";
cout << endl;
}
>>
>>70569482
When you make your own GUI library, you can make it as nice as you like. :)
>>
>>70569548
no you can't
>>
>>70569551
pretty sure he just did
>>
stdout is the best GUI library
>>
>>70569491
void pyramid(){
std::cout << " $$$$$$$\n $$$$$$$$$\n $$$$$$$$$$$\n$$$$$$$$$$$$$" << std::endl;
}

void pyramid(){
std::cout << " $$$$$$$" << std::endl
<< " $$$$$$$$$" << std::endl
<< " $$$$$$$$$$$ << std::endl
<< "$$$$$$$$$$$$$" << std::endl;
}
>>
>>70569561
ah fuck i forgot a quote
fuck
>>
>>70569491
This is the kind of shit they have you do in your first programming class to teach you loops. Use loops.
>>
>>70569547
That pyramid is just an example. I want to be able to print ascii art in the most efficient way.

         _nnnn_                      
dGGGGMMb ,"""""""""""""".
@p~qp~~qMb | Linux Rules! |
M|@||@) M| _;..............'
@,----.JM| -'
JS^\__/ qKL
dZP qKRb
dZP qKKb
fZP SMMb
HZM MMMM
FqM MMMM
__| ". |\dS"qML
| `. | `' \Zq
_) \.___.,| .'
\____ )MMMMMM| .'
`-' `--'


for example
>>
>>70569559
nope it probably sucks
>>
>>70569589
use raw string literals, plop the ascii arts in seperate files and do this
std::cout << R"(#include "art.file")" << std::endl;
>>
>>70569611
wait a second
can you do that
i don't even know
i'm tired
>>
File: 1548619514075.jpg (41 KB, 374x374)
41 KB
41 KB JPG
There's this junior development company ran by the students of my uni and I was invited to join in. They're asking me which field I'm more interested in: hardware, web development (app dev exclusive), app development (iOS and Android) or game development. I thought I'd only have to worry about focusing on a specific area way later into the course, but I can't help but think this will somehow define my future to a certain extent. what should I go for? I know web dev is kind of soulless and I know nothing about game dev besides it being fucking miserable, so I'm torn between apps dev and playing with hardware
>>
>>70569611
nice
>>
>>70569589
best way is probably with raw string literals

auto str = R"""(
this is a
multiline
string
)""";
>>
>>70569548
actual >>70569482 here, what did you do to make it nice?
>>
Never mind, I'm just gonna get some sleep.
>>
>>70569633
it might not work, i don't know how the preprocessor fucks with string literals
i really should learn, actually
you might need to put the R"()" in the actual file which would reduce the callsite semantics to
std::cout << #include "art.file" <<std::endl;
>>
HOW TO LEARN C???????????
>>
>>70569710
learn C++ first, C is included with the bloat
>>
>>70569710
OPEN YOUR EYES
>>
>>70569491
cout << "asd" << endl
<< "asd" << endl;

Or, much cleaner:
printf(
" \n" \
" $ \n" \
" $$$ \n" \
" $$$$$ \n" \
" $$$$$$$ \n" \
" $$$$$$$$$ \n" \
" $$$$$$$$$$$ \n" \
"$$$$$$$$$$$$$");
>>
>>70569631
hardware
>>
>>70569710
k&r
>>
>>70569710
do you have the required IQ of 80 and below? If so yes.
>>
>>70569656
Well I’m obviously still working on it, but I’ve got a pretty nice mashup of a Qt-like widget tree built on WebKit-like containers up and running already.
Im using simple function objects for binding things instead of signals/slots so there’s no preprocessing needed.
The visual interface builder is shaping up to be very comfy. I always thought that building UI’s was the best in Visual Basic, so I’m bringing that back here.
>>
>>70569710
do you know A or B? figure that shit out first.
>>
>>70569725
Why? What do you work with?
>>
File: 1550189006558.jpg (51 KB, 800x600)
51 KB
51 KB JPG
Perfect, nice and simple.

Like myself
>>
File: 1448833799953.png (240 KB, 935x720)
240 KB
240 KB PNG
>>70569087
This, C++ doesn't even have pattern matching yet
>>
>>70569775
>/g/
>work
We did do app development in school, it was atrocious. Always Russian roulette with the APIs, gigabyte-sized DooTheNeedfulWare™ IDEs, all around terrible.
Hardware is comfy, especially if it's embedded.
>>
>>70569785
pattern matching is an insignificant feature
>>
>>70569800
yeah, honestly Ive really wanted to mess with Arduino, but professionally-wise I don't see how it would be good for my career. maybe it's naive of me to think this, but I'm basically considering app development because doing it would mean playing safer I guess
>>
>>70569860
you're an insignificant feature
>>
>>70569198
>>70569204
AAAAAAAAAA I don't have time to do the needful I just want to (re)learn this crap. I remember starting some shit in it years ago, but dropped it for python because fuck compiling in that bloated mess
>>
>>70569896
take a shit
look into the toilet
take the first java tutorial you see in there
>>
>>70569896
don't make me do it
>>
>>70569863
You're quite tightly bound to frameworks though. It's essentially glorified webshit.
With hardware, you write C, and you can do that anywhere.
>>
>>70569896
>>70569920
Indians do not shit on designated streets simply because they are told to--designated shitting streets are in fact areas of concentration of power.
By shitting in a designated shitting street you can excavate greater essences of Java from the leylines through the poo
>>
>>70569333
>that delphi style interface builder

NICE
>>
>>70569008
how come nobody says RAII when talking about Rust even though it does the same thing
>>
>>70569339
you're never instantiating this class and it doesn't contain any private data so the default compiler-generated constructor will serve your purposes just fine
you should certainly have a virtual destructor though, if you intend to have any sort of polymorphic behavior. it's fine to leave it pure virtual
>What about empty destructors for normal classes
absent inheritance this is mostly pointless, unless you want to signal to your future self (or team) that you explicitly chose not to write a custom destructor (perhaps your class contains some pointers to dynamic data but it would be incorrect to delete them because another class owns them)
the
~MyClass() = default;
syntax is more elegant for this than defining an empty destructor imo
>>
File: 1399960207051.png (50 KB, 320x442)
50 KB
50 KB PNG
I didn't realise how much autism went into "correct" colour management. Where do people learn all of this sort of shit?
I just wanted to display some images and shit.
>>
>>70568341
What the fuck is this stupid fucking picture. Why would you be scared of a toaster, unless it was literallly your first time using the tasoter, aw fuck like fuck this is dumb
>>
>>70570590
whats colour management?
>>
>>70570641
It's about calibrating your colours so they are are displayed as accurately as possible. I don't really know anything more than that, otherwise I wouldn't even be asking.

I'm pretty sure most people outside of professional art-related software just ignores it, but it's something I'll need to get around to eventually.
>>
>>70570661
I use professional art software and I don't know what the fuck you're talking about
>>
>>70570670
Something about ICC profiles, colour spaces, gamma correction, and all that.
Maybe it's more relevant to photography, but I don't really know.
>>
>>70570708
if you are only working with digital images the only thing you might need to care about is gamma correction, the rest of that is about dealing with photos and print and other formats
>>
>>70570734
I'm doing wayland compositor stuff, so I'm supposed to be the one responsible for the final presentation to the screen. There is a very long thread in the mailing list talking about a colour management protocol, but I don't have a clue to what most people are talking about. Some people just want to display their colours really accurately.
>>
>>70570641
idk but it might be related to color management.
>>
>>70570760
>I'm doing wayland compositor stuff
I swear you are the only person who talks about their project apart from the OS guy in this thread

It seems strange that you would use color spaces other than sRGB at the OS level, and the only issue that comes up there is having gamma correct color blending because sRGB doesn't represent a linear light intensity
>>
>>70570809
i come here mostly for OS guy and other people who talk about their projects
>>
>>70569863
app development is now part of webshit, see react native
>>
>>70570809
It's not even sRGB most of the time, but plain linear RGB. I think the new colour management protocol will let the client tell us they're using sRGB so we can composite them correctly, though.
>>
>>70570850
sRGB is the format monitors work with afaik and most of the time that's the format you're dealing with. Linear RGB requires more data than 8 bits per channel to display accurately, but you want to covert sRGB to linear RGB to blend colors together for an accurate result
>>
>>70570734
You don't calibrate your monitor?
>>
>>70570872
What I'm saying is that we basically just ignored all of that shit. "Hey, I've got this XRGB8888 buffer, I'll just put this here in the most basic possible way possible using OpenGL."
Now that someone is trying to push for proper colour management, we should probably make the effort to do it the way we're supposed to.
>>
Brushing up on my math because I want to start getting into digital image processing with OpenCV and c++
>>
>>70570888
>basic possible way possible
basic way possible*
>>
>>70570888
yeah and I'm telling you it's actually very simple despite it sounding complex. You just need to covert from sRGB to linear RGB when you blend two colors together, then covert the final result back to sRGB when it needs to be displayed. That's how it works in my graphics engine, I am assuming you're doing something similar and not working with some other esoteric color spaces
>>
Is Python the Facebook of programming languages?
>>
>>70570912
no that's javascript
python is the twitter of programming languages
>>
>>70570910
Yeah, I don't think that part will be too hard, but then there is all of this business of ICC profiles, rendering intent, and some other gamma related shit.
>>
what are the characteristics of an interpreted language? If I keep adding to a homemade shell, implement a lexer/ parser, is that an interpreted language?
>>
What in god's cock is
decltype


I've read documentation. Lots of it. I am unable to comprehend what this keyword does. Not "not exactly", I haven't the slightest clue what it is

https://en.cppreference.com/w/cpp/language/decltype
Read this and tell me if I'm an idiot for being unable to parse what it is that this is doing
>>
>>70569666
technically i think it can insert new lines and such
>>
>>70570637
It seems to me you never had you dad beat you up for no reason.
Me neither, but I can totally understand such behavior when anything loud means unexpected, unexpected means you're at fault and that means beatings.
>>
>>70571085
> Inspects the declared type of an entity or the type and value category of an expression.
>>
>>70570888
The principle problem anon is that the frontbuffer has stayed at 24/32bit color for the last 20 years while the textures can be 16bit floats per channel.
In an ideal world we would have switched to linear rgb frontbuffers ages ago.
>>
>>70570809
>I swear you are the only person who talks about their project apart from the OS guy in this thread

I'd talk about my projects too but then you'd know my real name. Last time I did this people called me cute instead of commenting on my code. I appreciste it but yeah
>>
>>70571085
you take an expression or identifier and it gives you a type

int x = 5; // int
decltype(x) = 10; // int


i find it particularly useful when i dont want to have rewrite a long type

struct Foo {
std::function<void(CallbackData&)> callbackFn;

Foo(decltype(callbackFn) _callback): callbackFn(_callback) {}
}
>>
>>70571170
>i find it particularly useful when i dont want to have rewrite a long type
I usually do a using declaration.
t. another anon
>>
>>70571060
if the language is interpreted then it's an interpreted language
>>
>>70571154
fuck off homo
>>
>>70568396
not him but absolutely
>>
>>70571272
we can help you with the traumatised part
>>
>>70571228
Me? More like you faggots. I didn't post my pic here, YOU hunted my GH down. Your programming sock faggotry is the reason why there's only shitposting here. Nobody is gonna risk posting their RL shit here. The OS guy is nuts.
>>
>>70571085
it does exactly what it says
>>
>>70571311
this
trapfaggots and trap loving faggots are the cancer ruining /g/
>>
>learning comfy c++ at home
>come back at work
>have to use .n*t
why live
>>
>>70571322
quit your job
if you're not a retard you should have plenty of money saved up to live jobless for years. You do have it right?
>>
>>70571334
I've got $600 saved up :(
>>
>>70571322
.not .nut
>>
>>70571341
come on anon, you can do better than that
get yourself together!
>>
How do you pick a project to work on? I want to do something to build a portfolio but it all seems pointless if it's not perfect and I don't have any ideas for something fun or interesting
>>
File: awawa.gif (500 KB, 500x494)
500 KB
500 KB GIF
>>70571280
ready when you are daddy, please break my mind good and hard~
>>
>>70571366
hardly anon, I'm a poor student working part-time in a poorfag yuro country, I make like $300 a month and half of that goes to bills (which are still low since I live with parents)
>>
im board, one of you fags give me some cs homework to solve
>>
>>70571395
oh
well ganbatte!
>>
>>70571397
https://better-dpt-roll.github.io/
>>70571398
t-thanks :/
>>
>>70571397
write a constexpr brainfuck interpreter
>>
>>70571397
hi board
>>
>>70571395
>$300 per month
wtf doesnt the EU have minimum wage or something
>>
>>70571404
m8 im bored enough to do a 10 minute homework problem, most of the things on that link are 1 hour+
>>
>>70571408
it's 'honorary work' since you can't be employed full-time if you're a full-time student.
Mostly it's abused for cheap labor. I work part-time because if I did fulltime I'd be doing the same job for twice the lower wage, so fuck that
>>
File: 1510519582644.png (473 KB, 540x611)
473 KB
473 KB PNG
I want to work on my bash scripting project but I am tired. How do you guys deal with lack of drive?
>>
>>70571465
Caffeine and autism, mostly
>>
>>70571445
oh i see
well yeah youre probably lucky to be paid at all, most students try for 'internships' and dont get paid at all
>>
File: ZhG9Vvd.jpg (79 KB, 588x587)
79 KB
79 KB JPG
>>70571170
So it just returns the type and "declares" nothing

How is this different from typeid?

>>70571314
Unless I have no idea what "declare" actually means in computer programming, then it does nothing of the sort

Doesn't "declare" mean creating a variable?
>>
>>70571497
true and this way I get to abuse my condition so I can basically not show up any day I want, I just won't get paid for it since I get paid by the hour.
I was worrying about losing on all that 'potential' money that could be made though but I'd rather go home and study something on my own since I don't plan on pursuing this garbage enterprise webshit anymore
>>
>>70571517
decltype gives you a type and typeid gives you a value
>>
>>70571517
it's short for "declared type", you give it an expression and it gives you the type of the expression. The decltype itself is a type, not an expression, so you use it wherever you can put a type
>>
>>70571311
The OS guy is evidence that this board is harmless.
>>
>>70571404
well i rolled rock paper scissors
using System;
using static System.Console;

class Program
{
static void Main(string[] args)
{
while (true)
{
char[] options = {'r', 'p', 's'};
char computerPick = options[new Random().Next(3)];
WriteLine("Choose r, p, or s");
char userPick = ReadKey().KeyChar;
int userIndex = Array.IndexOf(options, userPick);
if (userIndex == -1) continue;
bool lose = options[(userIndex + 1) % 3] == computerPick;
WriteLine();
WriteLine($"Computer chose {computerPick}");
WriteLine(userPick == computerPick ? "tie" : lose ? "lose" : "win");
WriteLine("press key to try again");
ReadKey();
}
}
}
>>
File: 1.jpg (18 KB, 390x377)
18 KB
18 KB JPG
>lvalue
>rvalue
>xvalue
>glvalue
>prvalue
>>
File: c++ value categories.png (33 KB, 505x433)
33 KB
33 KB PNG
>>70571779
>>
>>70569785
who needs pattern matching when you have lambdas
>>
>>70571940
What do you mean?
With pattern matching you unlock a whole new world of how your code flows, the whole "nested if statement" type of code just doesn't exist anymore, and recursion is so fucking easy
>>
>>70568653
you don't really need concepts desu. the only new problems it solves are edge cases, everything else can be done with sfinae.
>>
>>70571779
Rust doesn't have this problem
>>
File: 25323523235.png (23 KB, 1600x1600)
23 KB
23 KB PNG
One of the teachers in my university (Eu not USA) says this language will blow up soon and skyrocket in popularity, is it true? Should i learn it?
>>
>>70571970
rust doesn't have user-definable move operations, which is worse.
>>
>>70571956
with lambdas you can implement pattern matching yourself
>>
>>70571940
pattern matching with lambdas is fucking shit, fuck off
>>
>>70571973
If C# had that potential it would have happened already tbqh.
>>
>>70571989
fuck off retard. flow control with lambdas involved in fucking cancer.
>>
>>70571997
It wasn't open until like 2 years ago tho
>>
>>70572002
>not implementing all control flow with lambdas
>>
>>70571973
Maybe if it wasn't controlled by microshit and cross-platform was easier.
>>
>>70572019
Micro$oft is unironically getting based in terms of devshit
>>
>>70572060
Only because of growing competition. If they ever reached complete domination of market, nothing would stop them from returning to shitty practices to prevent competition, something they're already guilty of doing multiple times. Fuck them.
>>
File: 1550145546552.png (273 KB, 489x448)
273 KB
273 KB PNG
>Search some C# courses
>Get flooded by Unity shit

All those game-dev faggots are in for a rude awakening when they realize they learned C# for literally one engine when everything uses C++
>>
>>70571973
Maybe. ASP Core jobs are increasing in my area lately.
>>
>>70572019
>cross-platform was easier
? .net core is cross platform and completely open source and ms released visualstudio code which is a cross platform ide for writing/debugging it
at this point its significantly better than java for cross platform development
>>
>>70571973
In England C# search results are the highest by far (not counting JS because they throw it on everything, node.js specifically is a like 1/4th the popularity)

Even more popular than PHP, which is crazy since every job seems to feel like a wordpress shitter job.
>>
>>70571973
well if you wanna be an enterprise webshitter, sure
>>
never knew dpt had this many C# shills
>>70572121
>everything uses C++
imagine being this sepples'ed
>>
>>70572221
What language do nu-game engines use then smartass
>>
>>70572237
blueprint
nobody programs anymore, grandpa
>>
>>70572221
He's not wrong. Just about everything in gamedev is C++, even Unity's internals are all C++, the C# part is just for scripting and they also have IL2CPP which converts all of that to C++.
>>
>>70572241
>he thinks a literal toddler tier drag&drop UI is a programming language
holy yikes
>>
>>70572255
enjoy your nodev life while I'm making milions from my indieshit without knowing what c++ even looks like
>>
>>70572241
>>70572264
Literally only UE4 has Blueprints lmao
>>
>>70572264
this is the programming thread. stop posting off topic and go somewhere else.
>>
>>70572292
I will once you stop being butthurt for no reason
>>
>>70572298
I'm not the other person, I'm just telling you you're in the wrong thread.
>>
>>70572304
no, I'm the right thread
you're on the wrong website if you can't take a joke
>>
>>70572308
>i-i-it was a joke
fuck off
>>
File: 4.jpg (45 KB, 800x450)
45 KB
45 KB JPG
>>70572309
>wow this guy was serious when he mentioned a scripting system, that only one single engine uses, as a replacement for a general purpose programming language that's dominating this subfield, I'm gonna tell him to go away like the good redditor I am!
>>
>>70572332
seriously just fuck off, dumb wojakposter
>>
>sepplestards are this autistic
who would've guessed
>>
>>70571676
I guess it might be different if he was more of a mentally ill sockposter
>>
>redditor calling others redditors
>>
File: 1544996374267.png (1.98 MB, 2048x2048)
1.98 MB
1.98 MB PNG
diff --git a/contributors b/contributors
index 97e542e..d48a83e 100644
--- a/contributors
+++ b/contributors
@@ -4,7 +4,7
- Oliver <surname>
+ Olivia <surname>

best PR I got so far
>>
>>70572389
should've rejected it
>>
>>70572389
based
>>
>>70572399
or proposed a change to just remove the last line
>>
Guys there is a Mooc to learn the language Pharo, should I go for it? I have literally no experience with OOP.
>>
>>70570837
Same, I come here for the few project people. 95% of posters in here are noise and shit.
>>
>>70572487
t. 95% poster
>>
File: 1553314904149.png (1.61 MB, 3840x2160)
1.61 MB
1.61 MB PNG
I need more programming challenges I did 99 bottles of beer on the wall this morning:


bottles_num = 99

while bottles_num > 0:
print str(bottles_num) + " Bottles of beer on the wall"
print str(bottles_num) + " Bottles of beer"
print "Take one down, pass it around"
bottles_num -= 1
>>
>>70572480
Why Pharo when you could learn a useful OO language like C#?
>>
>>70572644
its not even the right lyrics
>>
>>70572644
hate to tell you anon, but you are missing a line
>>
>>70572712

lmao I tried I didn't get the lyrics right

>>70572718
let me retry
>>
>>70572644
>85
that sounds interesting i might do it
>>
>>70572701
I'm not a Windows or enterprise cuck. The Problem I see with Pharo is that you are forced to use their shitty bloated IDE.
>>
>>70572761
stop right there, im going to bed in 30 mins, pick one which is doable in 15 so we can compete
>>
>>70572801
c# is cross platform and open source now m8
https://dotnet.microsoft.com/download
>>
>>70572803
its 7 am and i havent slept
good night anon
>>
>>70572821
damn it
oh well i should probably slip now too
>>
>>70568396
He's talking about the piece of toast
>>
I come here just to laugh at cniles and sepplefags
>>
File: =v.jpg (102 KB, 625x349)
102 KB
102 KB JPG
>>70571717
one of you fags critique my shit
>>
>>70572801
>i hate making useful programs
Google "dotnet core".
>>
>>70571717
>>70572947
it sucks
>>
>>70572906
I don't think I've ever seen a single productive person making anything worthwhile in another language here. It would be fun if there were
>>
File: 1456553226702.jpg (31 KB, 500x333)
31 KB
31 KB JPG
>>70572986
k
>>
>>70572947
There's not much to critique. It does what it's supposed to. Did you have some goal in mind other than that?
For example, your code isn't very extensible. Try to change the rules so that everything is the same but scissors also beats rock.
>>
>>70572989
I write C++, C# and JavaScript at work.
Also some C and Go.
I'm not very productive though lmao.
>>
>>70573201
Try to become a productive person, anon.
>>
File: want sum fucc niggy.png (204 KB, 496x441)
204 KB
204 KB PNG
>>70569491
global _start
section .text
_start:
mov r8, message
mov r9, 10
write_line:
mov rax, 1
mov rdi, 1
mov rsi, r8
mov rdx, r9
syscall
mov rax, 1
mov rdi, 1
mov rsi, newline
mov rdx, 1
syscall
inc r8
inc r9
cmp r9, 13
jne write_line
mov rax, 60
xor rdi, rdi
syscall
section .data
message:
times 3 db 32,
times 13 db 36
newline:
db 10
>>
>>70573216
But work is boring and I don't want to work.
>>
>>70573229
>that sexy asm

I wwill smash dat pussu up so hard you'll turn inside out niggy
>>
>>70569333
That is incredible mate, keep it up!
>>
o-only 100 more pages to go til I can start writing complete garbage
>>
File: jq9fhse9nub21.jpg (54 KB, 935x936)
54 KB
54 KB JPG
>>70573281
didn't even link libc
sending those syscalls raw bb ;)

Also, >>70569491
You really shouldn't be using std::endl that much. It calls std::flush, which is probably not what you want, since it will cut into performance if you use it for, say, writing a lot of lines to a file. A newline character is good enough.
https://www.youtube.com/watch?v=GMqQOEZYVJQ
>>
>>70568653
>*meows*
kys tranny
>>
File: D1e8EepU0AEJGq_.png (294 KB, 676x676)
294 KB
294 KB PNG
>>70573394
Oh yeah, and this advice goes for all the other 2nd year CS students in this thread posting code with std::endl.
>>
>>70570003
>>70573337
Thanks anons :)
>>
How to I draw to the screen in c in Linux? I want to make a game and learn c at the same time
>>
>>70573497
Actual graphics? OpenGl.
Characters in your terminal? Ncurses.
>>
Anyone know any good DAX tutorials. Trying to do measures on PowerBI and finding the syntax quite confusing.
>>
can't you like run a C code in C# or C++? why do people say they write in C# and C rather than just C#?
>>
>>70573542
2d game, only basic but not text
>>
>>70573575
you can call C code from C#, but you can't write C code in the middle of C# code and expect it to work

you can write most C code in the middle of C++ code and it will work
>>
File: Screenshot_6.png (142 KB, 373x246)
142 KB
142 KB PNG
>>70573601
wait so they're not the same language with embbed libraries? that explains it then. thank you anon
>>
>>70568466
Using getchar() like that moves your file position by one, disrupting fscanf(). Test for EOF using feof() or some other method.
>>
>>70572947
>>70571717
Here's how I would do it in C#.
https://repl.it/repls/SourStarchyInfo
I used some C# 7.0 features so it won't run on repl.it.
If you want to try it yourself you have to create a program that targets .NET Framework 4.7.2.
(I realize you used Java but I haven't touched Java in ages and C# is close enough).

This is way overkill if all you wanted was the regular rock, paper, scissors game.
But I've made it so that it's easy to create new rule-sets, add new moves and results to the game. Let's say you add a rule-set where all the results are reversed, rock beats paper etc.
You could then play every other round on that reversed rule-set like this:
while (true)
{
GameStep(normalRules);
GameStep(reverseRules);
}


>>70573587
SDL.
>>
>>70573544
DAX as in direct (file) access?
>>
>>70573647
>SDL.
Thanks
>>
File: 11.jpg (78 KB, 1125x571)
78 KB
78 KB JPG
QUICK!

It's been a year since I last wrote any code (I spent 4 years using C/C++/Java/Python daily, using Visual Studio and Eclipse), 2 years ago I switched to a DBA role.
Now I want to move to a different country, and I've sent my application to tons of companies, on one hand I'm lucky that a lot of them are interested and are making me take their respective exam, but on the other I've applied to some software engineer roles and I want the best possible IDE to help me with this.
I'm fine with using Visual Studio again for C, but how about Java? Should I go back to Eclipse?

Pic related, one of the bigger companies.
>>
how do I get recruiters spamming my email address instead of unemployment?
>>
What's everyone's favorite language
>>
>>70573820
>P&G
Yikes. https://www.youtube.com/watch?v=koPmuEyP3a0

IntelliJ is probably your best bet for Java.
>>
>>70573851
C++ fren
>>
>>70573587
>>70573647
Yep, SDL is the right choice, the doc is really easy to read for a beginner.
>>
File: Capture.jpg (17 KB, 491x244)
17 KB
17 KB JPG
Yeah, it's a homework question but I'm trying to write parser for pascal and I don't know much about it. Pic related is example output .
How is this error generated?
>SEMANTIC: Assign types: integer := undef
How is int + int and int * 2 results in undef? If C is anything to go by int + int * 2 should result in int, no?
>>
File: g.jpg (33 KB, 265x273)
33 KB
33 KB JPG
>>70573843
You know how everyone tells you that you need experience to get a job, but to get experience you need a job? That's the painful truth. See pic related, as someone with 5+ years in a multinational company, recruiters will try to poach you everyday.
If you're still in college, find internships, doesn't matter if they drag you through shit stained glass without even paying you, you get an internship at college and put that in your resume.

>>70573853
Only look at your employers as something that gives you money, never beyond that, never be "loyal" to an employer. I say this despite the fact that I've literally spent the past 7 years in a single company. No, not because I like what we do but because it's 15 minutes away, pays me well enough that I can afford to fly to other countries several times a year, I've been getting consistent salary increase annually, and I get a reasonable amount of paid vacation days every year.
So if your company does whatever, be it something stupid like that ad, or some unethical shit like purchasing conflict minerals, ignore it. Get payed, save up, start a business (you'll never get filthy rich just by working a 9-5 job, you may live comfortably, but good luck getting that Huracan Performante).
You're there because they pay you, that's it.

Anyway what I'm trying to say is I hope you guys are able to do what makes you happy, it's what I'm trying to do as well and boy does money make things a fuck lot easier.

Off to finish all these dumbass fucking online exams.
>>
>>70573851
I just use C.
Cant be bothered to learn anything else
>>
>>70573396
Look at the pic tard
>>
File: IMG_20190416_152917.png (20 KB, 593x250)
20 KB
20 KB PNG
>zammel
What the fuck
>>
>>70574123
well yea, how else do you pronounce it
>>
>>70574163
Ex ay em el
>>
File: 1483880194031.jpg (20 KB, 720x404)
20 KB
20 KB JPG
>>70574039
>I hope you guys are able to do what makes you happy
god I wish
>>
File: alex tinfoil.png (857 KB, 1280x720)
857 KB
857 KB PNG
lel
https://godbolt.org/z/_K1Gid
>>
>>70574199
>server not found
what was meant by this
>>
>>70574189
I’m doing what makes me happy at the moment. I don’t know how long I can continue doing it, but I cherish every day.
>>
>>70574199
shit, did the compiler explorer go down?
>>
>>70574199
https://godbolt.org/z/3qurXh
absolutely pathetic
>>
>>70569302
What a shitty recommendation.
TAOCP is dry as fuck and should be treated more as a reference book than anything else. Way to kill a newbie's motivation by telling him to read it.
>>
>>70573948
Look closer at this line.
var A, B, A: integer;


That second A should have been a C. It says SEMANTIC because the tokens are lexically and syntactically correct, but not following rules of meaning. A compiler needs to check everything is logical enough to keep compiling.

Pascal used to be more widely known, but that example could just be read as psuedocode.
>>
>>70574264
I know, I just noticed that clang had a threshold where it would stop unrolling a loop, but multiples of the same loop wouldn't trigger it.
>>
>>70568436
> go to a site that has at least the basics of the language you want to learn (would recommend c if you want to know technical stuff or python if you really give no fucks about low lever stuff)
> set challenges for yourself that uses those basics
> set a bigger challenge for yourself that uses every single one of those basics together, like a minigame or miniprogram
> repeat
>>
>>70574297
Ah yeah, thanks
>>
>>70573229
inefficient. compiler can do it better.
>>
>programming test in uni
>free points everywhere
>people manage to get 0 points cuz it couldn't be compiled
How?
>>
File: 1551934094891.jpg (66 KB, 800x600)
66 KB
66 KB JPG
I am fucking retarded, can someone guide me through uploading a .net-core project to github? What do i add to the .git-ignore
>>
>>70574512
>cuz it couldn't be compiled
You just answered your own question
>>
>>70574522
>What do i add to the .git-ignore
*
>>
>>70574522
You need to add all code and project files, as well as the solution file.
So add:
.cs, .fs, etc. for code files
.csproj, .fsprojc, etc. for projects
.sln for the solution.

Everything else should be ignored.
Here's my .gitignore for a project I'm working on.
You don't need the .db line, it's for sqlite databases.

.vs/
bin/
obj/
*.db


After you've created your repo, try cloning (as in git clone) it to a different location on your computer and making sure that it builds.
>>
>>70574522
>>70574598
don't forget
*.cs
>>
>>70574598
>>70574610
thanks! What does the prefix * mean?
>>
New thread:
>>70574683
>>70574683
>>70574683
>>
>>70574634
It's called globbing: https://en.wikipedia.org/wiki/Glob_(programming)
Basically, it just means "match anything".
>>
>>70574634
All files that end with ".db".



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.