[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: 1523540960971.png (474 KB, 1902x3854)
474 KB
474 KB PNG
What are you working on, anon?

Previous thread: >>65550948
>>
First for sepples
>>
trying to do babby-level dynamic programming problems and struggling
>>
>>65555017
>what are iterators
>what are concepts
>>
textboard (later imageboard) in python+flask
any free hosting to test on beside Heroku? no need for big storage for now
>>
>>65555064
I know this feel
>>
>>65555072
>iterators
>allows data structures other than specified ones
>allows data types other than specified ones
nice try
>>
Again, a dependent imperative type theory.
>>
File: scrot.png (1.75 MB, 1920x1080)
1.75 MB
1.75 MB PNG
>>65555129
Do you need to have it accessible online? A VM always works. If you can afford 10$ a month you can buy a VPS from linode or something and it will be more than enough. Definitely worth the money.

I don't know any free hosting besides github.io pages for static things.

>>65555017
>What are you working on, anon?
Screwing around with this script I started yesterday to download and rotate wallpapers from /w/ and /wg/. Also playing with my image glitching script.
>>
modafinil trap has man shoulders. Not a trap at all, really, just a bloke in a dress.
>>
MyLanguage -gt YourLanguage

fite me faggets
>>
>>65555144
any tips or resources?
>>
What do you guys listen to while coding?

I'm giving Nightcore a go
>>
>>65555238
asmr or industrial. I find lyrics distracting.
>>
>>65555166
wut
>>
>>65555288
>What are you working on, anon?
>>
>>65555295
I meant, what is that
>>
File: 1517919983256.png (29 KB, 205x269)
29 KB
29 KB PNG
>Eclipse doesn't support CMake yet
>>
File: 3116044489.jpg (20 KB, 300x300)
20 KB
20 KB JPG
>>65555017
It's almost like C++ isn't actually very expressive and is really just a meme in general :^)
>>
File: 1521777229187.png (239 KB, 467x462)
239 KB
239 KB PNG
>>65555329
The male gender is a meme.
>>
File: .jpg (52 KB, 476x454)
52 KB
52 KB JPG
I cant wait until TWENTY TWENTY SIX when C++ has reflection, concepts, co_routines (LITTERALY a 10 LINE GCC PATCH), networking, and gimped ranges

and then ten years later when its supported on production compilers
fugging kill me
>>
>>65555354
use boost
>>
>>65555318
Another way to put it would be: a functional (higher-order) & imperative language with dependent types for formal verification.
>>
>>65555017
I'm working on homework for a statistics class disguised as a "Performance Analysis" class
>>
I chose to write a math lib in c99 just cuz i saw another project do it
>>
>>65555354

You don't need that shit. Go beat your dick to hentai of your mother
>>
>>65555329
>muh boilerplate
kys
you abstract it away in a module
>>
>>65555366
ur retarded
>>
>>65555329
don't post wojak
>>
>>65555323
PEBCAK
https://cmake.org/Wiki/Eclipse_CDT4_Generator
>>
>>65555017

>>65555555
Checkin this big ass number
>>
Just found out C#.NET offers a simple way to work with SSE SIMD through System.Numerics. Pretty fucking NEAT!
>>
typedef struct chuck {
int feed;
int seed;
} sneed;
>>
I want to create a relational database software (yes sth like mysql, microsoft sql etc) i'm looking for resources online but they don't get deep enough into the subject if anyone here is familiar with it a book reccomendation would be appreciated
>inb4 hurr durr that's too big of a project , hurr durr why not use am existing one
>>
>>65555604
just use sql u retard its so fast
>>
>>65555438
after seein what c++ is like with these features why would I ever want to use c++14
im with her now
>>
>>65555604
Read about ACID compliance and then rethink ever wanting to make your own dbms.
>>
>>65555210
But what if MyLanguage and Your Language are the same.
>>
Reminder that C > Java > C# > ASM is the ultimate beginner progression to learn programming.
>>
>>65555785
>going from java to java
what's the point?
>>
>>65555785
>Java > C#
one makes the other redundant.
There's no FPL in there as well.
>>
[C#]

I'm using System.Drawing to draw Sierpinski's Triangle recursively. As of right now the final triangle just pops up in a windows form, but I would like to see the animation of it being built. How can I accomplish this? I've never done graphics before.
>>
>>65555785
>tfw went from Java > ASM > C > JavaScript > C++ > C#
>>
>>65555017
Is this not a valid way to use the ? operator?
      input1.length() < input2.length() ? sumArrays(input1,input2): sumArrays(input2, input1);
[\code]

Is the only way to accomplish this by doing
 if(input1 <  input 2)
sumArrays(input1,input2);
else sumArrays(input2,input1);

Language is Java btw
>>
I'm trying to make my first mobile app using Xamarin forms. I've never done mobile development, cross platform development, used visual studio, or c#, so this is shit going.
>>
>>65555839
Order of operations
Your stuff says:
input1.length() < (input2.length() ? sumArrays(input1,input2): sumArrays(input2, input1)) ;


Try this as the condition:
(input1.length() < input2.length()) 
>>
>>65555839
https://stackoverflow.com/questions/15977031/java-ternary-without-assignment

You're supposed to have assignment or return before the ternary expression, and according to this link, it's an error to use void functions in those parts of a ternary expression.
>>
>>65555832
pls help
>>
>>65555839
Make a custom ternary operator function LOL
>>
There should be a better serialization utility, right?
>>
>>65556063
I recommend using wpf and drawing everytime you update the tirangle. WPF bindings are god tier.
>>
>>65556088
Thank you
>>
>>65556069
beautiful yet complex language
>>
>>65556069
>auto
>friend
>incorrect operator overloading
>reinterpret_cast
F- see me after class.
>>
>>65556131
It's far from beautiful. I like it though. I like ugly girls too.
>>
>>65556069
I cringe too hard when I see auto.
Go back to python.
>>
>>65556147
>>incorrect operator overloading
std::huh?
>>65556156
>auto
>python
std::experimental::huh?
>>
>>65556172
go back to python
>>
>>65556176
>auto
>python
std::experimental::huh?
>>
File: 1522280161860.jpg (49 KB, 481x523)
49 KB
49 KB JPG
>type inference is dynamic typing
>>
>>65556172
why the literal fuck are you using an Student r-reference instead of const Student r-reference you braindead little shit?
std::mcfucking::kys(std::you, std:end);
throw std::logic_error("fuggggg");
>>
>>65556119
No problem. Also, a better light weight approach is drawing on a canvas element yourself (need x, y, brush thickness and color) instead of setting and updating an image everytime (which can be troublesome when binding to the image element because you need an ImageSource and for that you need to init a bitmap and write to its source and end the init).
I think you can also do this in winforms.
>>
>>65556208
>using an Student r-reference instead of const Student r-reference
That's not an incorrect operator overloading. In fact, for something as trivial as that, modern compilers should automatically treat it as a const reference. Are you dense?
>>
>>65556186
what do you call a shitty type system?
dynamic typing.
>>
>>65556236
>relying on compilers to not have horribly evil subtle devious bugs
ignorance is truly bliss, i wish i was dumb as you so everything is happy and sunshine.
>>
>>65556261
I see that you are implicitly retracted from the claim that the op overloading is incorrect.

The more you learn...
>>
>>65556156
kys Ctard
>>
>>65556286
poor (non defensive) style is incorrect code.
>>
I tried to do this in C# but apparently it doesn't work:

int[] colourRules = new int[8];
colourRules = {0,1,1,0,1,0,0,0};

What should I be doing?
>>
>>65556409
int[] colourRules = new int[] { ... };
>>
>>65556409
static constexpr int colourRules[]{0,1,1,0,1,0,0,0};
>>
>>65556442
>>65556449
I should have mentioned that my intent was to have the second line of code be optional, but guarantee that colourRules would have 8 values.
>>
Anyone got any ideas for an alcohol related project? Given how much I'm drinking nowadays I might as well be productive while I partake.
>>
>>65556477
constexpr int length = 8;
static constexpr int rules[]{0,1,1,0,1,0,0,0};
static_assert(sizeof rules / sizeof *rules == length);
int colourRules[length];
std::copy(rules, rules + length, colourRules);
>>
>>65556478
real-time blood alcohol monitoring, with alerts to warn you if you're getting sober
>>
>>65556409
int[] colourRules = new int[8];
...
colourRules = new int[] { ... }
>>
>>65556637
Tried that already.
>>
>>65556674
I tried it again and now it works even though I could swear I did it exactly like that.
>>
>>65556243
Dynamic typing isn't necessarily bad. If you have first class types it's just lazily checked dependent typing.

Done poorly, you get JS or PHP.
>>
>>65556409
int[] colourRules = {0,1,1,0,1,0,0,0};
>>
>>65556069
you should reinterpret_cast to std::byte* or unsigned char* for accessing object representations

>>65556147
>>65556156
>>65556176
are you seriously so retarded that you think type inference and dynamic typing are the same thing?
and he's using reinterpret_cast in one of the few scenarios you're actually supposed to use it

>>65556208
that's an lvalue reference, not an rvalue reference. it should be const, though
>>
>>65556685
FYI it should be named ColourRules according to C# standards
camelCase only for function arguments, PascalCase for everything else
>>
Just finished first year of CS, basically one year of C++. Next year we learn more, and we're using java instead of C++.

I'm getting a head start now. Should I go with latest Java 10, or Java 9? Or...Java 8? I have kind of gotten the idea that Java is like Python, and that half the industry is a bunch of fucking spergs that can't move on. Ultimately, this affects me because I need to know what version to learn with. Does it even matter that much?
>>
I have a struct with a single type (let's say, int) and I want to implement a general method to get/set a the int.

For example, student.getGrade<mut>() should yield a mutable reference to the int and student.getGrade<immut>() should yield a constant reference to the int. How should I implement this?

I'm thinking of creating an enum class for mutability. Then create a templated method for getter/setter. Then specialize template method according to the mutability.

And no, I don't want to create separate getter/setter. I'm just revisiting C++ after a long time and need to get my hands dirty with templates and all sorts of type autism.
>>
>Find site with Java applet from 2005 that I want to run
>Install JDK 1.4 from some Korean university website and try running it on Internet Explorer
>Crashes
>Download the jar and use a decompiler on it
>Open it in Eclipse and make a few modifications
>It runs

Thanks for reading my blog.
>>
god damn c's fuuuuuuuuuuuuuuuuuuuuuuuuucking arrays with only one type
>>
This is how you open a file select dialog in Windows.
>>
>>65557217
Are you a retard?
That's a holdover from C. Functions that deal with system calls often use return codes for error handling.
You're supposed to CHECK THE ERROR and then continue, retard.
You don't need to stack conditionals like that.
>>
>>65557250
>IFileDialogEvents
Anon, it's sepples.
>>
>>65557112
Java is nothing like Python. Python has broken itself no less than 3 times in its short lifespan, making each milestone version incompatible with the last.
Java is extremely good at avoiding this, and at the worst you'll get the compiler bitching at you about deprecated features in old codebases. Anything you can do in Java 6 you can do in Java 7 8 9 or 10. All these updates do is add new ways to do this or more efficient things like lambda expressions.
>>
>>65557250
It's not mine code by the way.
https://msdn.microsoft.com/en-us/library/bb776913(v=VS.85).aspx
>>
>>65557264
>C libraries aren't used in C++ all the time hurr
Nigga I know that Microshaft only has a C++ compiler
Because it's supposed to be backwards compatible with C
>>65557279
It's an example, not the gospel.
>>
>>65557250
That looks like its straight off MSDN
>>
>>65557264
>That's a holdover from C
>holdover
>>
>>65557283
>>65557285
The API accepts a C++ class as an argument. It's not C.
>>
>>65557302
autism and pedantry 101 right here
functions that return status codes are a holdover from C

like talking to a goddamn ESL
>>
Elixir master race
>>
>>65557313
How the fuck is this a holdover from C if it's MEANT to be used with classes? Not just stylistically, the functions accept and register fucking classes and all actions are performed by calling methods of those classes.
>>
>>65557213
Just do something like
struct heterogeneous {
int n;
int *sizes;
void *elements;
}
>>
>>65557278
>short lifespan
Python is older than Java.

What the hell do you consider a long lifespan if Python's is short?
>>
>>65557365
what have you done recently with it?
>>
>>65557448
Python wasn't really a language until it was christened with a full 2.0 release, which it completely broke compatibility with not even 8 years later. That's a really short timespan for a language to break itself that fundamentally, Perl is nearly 30 years old and still hasn't broken itself since Perl6 isn't an officially stable release yet.
>>
File: literally me.png (66 KB, 693x517)
66 KB
66 KB PNG
I just turned this monstrosity in for a homework assignment. Just how bad is this, 1-10? I could've probably just searched google a better solution but I got carried away.

The assignment was to take integers with up to 50 digits and add them together.

I can't even fit it all in one post because its more than 2000 characters, so here's a link. On the plus side, at least it actually works as far as I can tell.

http://dpaste.com/1DBEXNW
>>
>>65557607
>java
stopped reading there
>>
File: 1453651274892.jpg (27 KB, 263x217)
27 KB
27 KB JPG
>>65557607
>what is 4loop
>>
>>65557538
If Python "wasn't really a language" until 2.0, then hasn't it only broken compatibility once?

>>65557607
fyi for future assignments, your teacher may be borrowing from Project Euler:
https://projecteuler.net/problem=13
>>
>>65557607
This assignment is from the Dietal - Java Early Objects book, isn't it anon?
>>
Just finished a homework assignment for my c class. I'm still a noob and I struggled with it for a while, but I feel like I learned a lot and feel pretty accomplished.
>>
>>65557740
post it and be judged
>>
Thoughts on C++?
>>
>>65557781
GOAT language
just mentioning infuriates brainlets, poo's and soyboys
>>
>>65557781
I'd prefer not to.
>>
>>65557781
Doesn't exist.
>>
>>65557776
I'll post it tomorrow after the deadline, just because I'm probably unreasonably paranoid.
>>
>>65557629
I prefer C, but unfortunately this class requires us to use Java. Fortunately I familiarized myself with the language a long time ago, so I can pretty much just skip all the classes. Unfortunately, attendance is like 10% of the grade, which is total BS.
>>65557668
delet this!!!
>>65557704
Looks cool
>>65557739
Maybe. I didn't bother buying the textbook because it looked like a pile of shit.
>>65557740
What was the assignment?
>>
>>65557825
You could have handled that string input using the BigInteger class.
>>
>>65557607
make it so you can just call sumArrays(input1,input2) and swap the input inside sumArrays if necessary
>>
>>65557825
Looks like a former student posted it here:

http://www.chegg.com/homework-help/questions-and-answers/structures-circular-arrays-ve-tried-writing-program-cant-seem-figure-pass-struct-function--q25076663

Assignment still pretty much the same, with a few differences. The PSI change is now 150. Under "Musts" it now also requires two separate files for your program.

I didn't use that site and cheat though.
>>
>>65557896
Looking at it a little more, I was also required to output the data to a text file. and maybe a few more changes. Basically the same idea though.
>>
>>65557896
Looks cool anon. Doesn't seem too difficult but also not entirely too easy. Must've been fun. How long did it take to complete?
I wish my school used C instead of Java and I wish we had assignments like that instead of the trivial ones we do.
>>
>>65557942
A few hours on Saturday and a few today. Probably could have been done much faster, but I had some errors and had trouble fixing them. Plus there was a storm today and my power kept going out.
>>
>>65557369
This just shows how little you know about C and C++ in general.
If this was designed to be used exclusively with C++, it would be using exceptions. Not returning status codes.
You would know these things if you used either C or C++ for more than a month.

What is the entire debacle of "C++" vs "C with Classes". Windows was created in the midst of all of that you know.

Without context, all you do is make yourself look like a fool by spouting idiotic statements.
>>
Trying to get a job in this fucking industry.
>>
>>65558150
As someone who has had a job in the industry. Either become trans and apply for some place that pays over $100k a year and get hired due to diversity quotas. Or get a job at target and just accept that trans people need jobs more than you and you are worthless to society.
>>
>>65558164
>become cute anime girl
>get loads of money and coddled at my job
>>
>>65558164
>
why did the fucking retarded society had to liste to SJWs?
>>
my OS prof told me that going into OS doesnt have much future. is this true? i kinda believe it, what kinda job i can get by studying the oS anyway?
>>
>>65558164
can I claim to be woman and keep growing the unix beard
>>
File: 1520723930688.jpg (54 KB, 540x960)
54 KB
54 KB JPG
>>65558192
I don't see why not

>>65558184
See Terry Davis for the answer to this.
>>
Writing a Chip-8 emulator. More than halfway through implementing the opcodes, will just have to figure out drawing graphics.

Top Tier project if any of you are bored.
>>
>>65555017
I'm so glad I quit this shit 5 years ago. Do you actually think you are making things better with this bs?
>>
>>65558098
C has neither classes nor exceptions.
>>
>>65558231
Jesus fucking Christ what the fuck do you think C with Classes was supposed to be
>>
File: .jpg (243 KB, 1200x875)
243 KB
243 KB JPG
>>65558184
just get a job in embedded and you can justify being 10 - 20 years behind of ANY trend forever and ever
write iot os's
>>
>>65557739
I'm learning java with this book.
Difficult but we'll writen.
>>
>>65558205
i rly like this trap
>>
>>65558205
hot
>>
>>65558098
>If this was designed to be used exclusively with C++, it would be using exceptions.
not necessarily, there are a shit ton of different use cases and different ways to do things, you can just ignore a lot of sepples features and do just fine
>>
>>65558164
Or be white.
>>
>>65558319
That's a nice pic of me.
>>
>>65558240
>C with Classes
Doesn't exist.
>>
File: 1495094859108.jpg (69 KB, 720x720)
69 KB
69 KB JPG
C++ is the greatest programming language on Earth.
>>
how do I contribute to open source projects when I'm garbage at programming
>>
>>65558224
Sounds incredibly interesting, anon. Tell us more about it
>>
>>65558553
TWENTY
TWENTY
SIX
>>
>>65558553
C++ is just a quirky DSL for LISP.
>>
File: 1518841268024.jpg (1.54 MB, 1920x1080)
1.54 MB
1.54 MB JPG
>>65558657
I thought it was 2020.
Nevertheless, C++ is the greatest language on Earth regardless of the current year. C++ will only grow more powerful over time.
>>
>take a look at java spring
>its an absolute enterprise mess
why do pajeets do this
>>
>>65558422
you are very cute and beautiful anon :3
>>
>>65558679
c++ is a corporate language like java
if you actually have passion you would use something like rust or haskell or lisp or even C99
>>
>>65558098
The code is C++ because it won't compile in C. End of story. The fuck are you even trying to achieve here?
>>
>>65558703
>rust
BC is trash. I don't like being told what I can and can't do, I'm a grownup who knows what I'm doing.
>haskell
Slow, functional, interpreted. I.E. pure trash.
>C99
Ancient (zero good abstraction facilities), inefficient (void pointers over templates, no type traits). Trash.

If your language doesn't support zero overhead abstractions, can't trivially compile to a freestanding environment, and can't easily write a 16bit constrained bootloader in, then it's pure trash.
>>
>>65558703
rust is a shitty wannabe corporate language
h*sk*ell and l*sp aren't worth mentioning
>>
>>65558747
nearly everything you said is factually incorrect and all your opinions are wrong
haskell compiles to bytecode btw

>>65558759
i agree that rust is a wannabe corporate lang, but it isn't yet
>>
>>65557607
i suppose using BigInteger was disallowed?
>>
File: 1519590300494.jpg (101 KB, 800x1200)
101 KB
101 KB JPG
>>65558764
>haskell compiles to bytecode btw
You're point? bytecode is interpreted by some piece of software that isn't the CPU's microcode. Therefore it doesn't qualify for consideration.

>nearly everything you said is factually incorrect and all your opinions are wrong
Oh ok, you've convinced me that I'm wrong and you're right.
>>
>>65558788
yes
>>
>>65558795
Yes as in you like the pic?
>>
>>65558827
that too but also you're wrong and im right
>>
File: 1499215316802.jpg (99 KB, 832x720)
99 KB
99 KB JPG
>>65558833
No, you're wrong and I'm right.
>>
>>65557250
>You're supposed to CHECK THE ERROR and then continue, retard.
>You don't need to stack conditionals like that.
the nesting achieves the effect of tying the lifetime/validity/visibility of state to scope, which makes it much easier to avoid leaking memory, or accessing an invalid value, or leaving your code or the API in an invalid state, etc. consider for example how that code allocates/deallocates objects and hooks/unhooks event handlers in a scenario where the relevance/validity of such actions are hierarchically dependent. any of those error checks could fail, and what needs to be deallocated/unhooked depends on where the failure occurred. it's essentially just applying the underlying principle of RAII/exceptions/try/catch without actually using those things

>>65557264
>>65557302
>>65557369
>>65558231
>>65558703
the Win32 API can be used in both C and C++. it can in some cases throw structured exceptions (which can be handled from both C and C++ code), but it doesn't throw standard C++ exceptions, because that would make such code incompatible C. API functionality is implemented with a common substrate compatible with both C and C++, and it exposes a language-dependent interface composed of simple wrappers/indirections, in order to avoid having to implement everything twice. so it essentially is a "holdover" from C, in that it's a common denominator scenario
>>
>>65558900
>>65558703
oops, not you. i meant
>>65558728
>>
File: 1508938828509.png (1.9 MB, 1200x1600)
1.9 MB
1.9 MB PNG
>>65558184
Valuable systems and low level programming experience.
>>
>>65558150
>not transexual
>not a pajeet
>expecting a career
why did i let /g/ sell me the cs meme
>>
Can any of you semi late night goys help me get into programming?

Im completely lost, i have no idea where to start aside from a "CS Degree" Torrent with some slides from a Uni course.I don't plan on making a career of it, in all honestly i'm just bored and killing myself in the near future and wanted to try and see if maybe i can develop a passion or interest in it.
>>
>>65559180
dont kys, take hrt and have a new lease on life
>>
>>65559184

I would much rather kill myself then chop off the only redeeming quality about myself
>>
>>65559189
you dont have to get surgery idiot
>>
>>65559193
>>65559184

Stop projecting your fag trends onto me cock sucker.
>>
>>65559184
I love the feminine peepees
>>
>>65559204
don't listen to those anons. you don't have to take hrt or surgery. just buy a pair of programming socks and you'll be good
>>
Sepples 2020 is adding coroutines LOL. When do you think java will work on it?
>>
>>65559242
c++ is unstoppable
and java, they should really start fixing their shitty vm
>>
>>65559267
Has anyone compiled a list of features to not use in C++ yet?
>>
File: ricky.jpg (19 KB, 222x293)
19 KB
19 KB JPG
>>65558680
>guy with a scarf and a beard gives a talk .mp4
>its about another javascript pancake with 50 new layers of abstraction
>"Wwith jsANUS, my dog can shit and my multi platform responsive big data app is deployed".
>the whole audience applauds
>>
>>65559317
Yes, any C feature obsoleted by C++.
>>
A new IDE for Perl 6 will have its beta release in May. How excited are you /dpt/?

http://www.commaide.com/features
>>
>>65559343
electron?
>>
>>65559343
In order to care for this I should care for perl6 in the first place. Why should I?
>>
File: Meme.png (64 KB, 595x760)
64 KB
64 KB PNG
I'm heartbroken, /g/. nogenerics.info doesn't redirect to golang.org no more :<3
>>
>>65558326
that's an oxymoron anon
but it seems you are just a moron if you don't know what a for loop is and have to write 85 lines of code for something so simple
>>
>>65558205
So close, but those man hands.
>>
>>65559376
That's C, not C++. C is ugly as sin.
>>
>>65559346
what about it?

>>65559354
I'd say Perl 6 is the most fun scripting language out there. Perl 5 is definitely showing its age and who like Python or Ruby? You should take a look at the Intro to Perl 6 brochure

https://github.com/perl6/marketing/blob/master/Brochures/Introducing-Perl6-Brochure/Introducing-Perl6-Brochure.pdf
>>
>>65559389
C++ uses the same syntax for declarations.
>>
is there any value in learning golang?
it seems to be a fast little language with some features for parallel processing and concurrency.
ive seen it mostly used as backend software but is there anything else its good for?
>>
>>65559389
>>65559447
C++ is far uglier than C.
Outside of function pointer declarations, C is mostly aesthetically pleasing.
>>
>>65559464
If your C++ code is uglier than your C code, you're doing it wrong.
>>
File: C++ in a nutshell.png (72 KB, 1016x98)
72 KB
72 KB PNG
>>65559479
Are you literally blind?
>>
>>65559464
void* add_int_with_float()
void* add_float_with_float()
void* add_double_with_float()
void* add_double_with_double()
void* add_int_with_int()
muh aesthetics
If by that you mean repeating yourself like a braindead retard, yes
>>
>>65559242
wow only took them 6 years to add a 10 line patch to GCC
>>
>>65559491
I dare you achieve the exact same thing in C within 150 SLoC
>>
>>65559491
Now try writing equivalent C code. If it's possible at all you'll have to use mountains of macros.
>>
>>65559496
That has literally nothing to do with the aesthetics of a language's syntax.
Also, you put your * in the wrong place, you stupid sepples tard.
>>
>>65559506
>>65559510
void *a = b;
>>
>>65559533
Lol
>>
>>65559533
You don't know what you are talking about. Common trait for cniles.
>>
File: 1521966467499.jpg (679 KB, 1920x1080)
679 KB
679 KB JPG
>>65559464
C:
typedef ret (*foo)(params...);


C++:
using foo = ret (*)(params...);
>>
File: 1523173139460.jpg (119 KB, 708x631)
119 KB
119 KB JPG
>>65559533
>>
Anons, do you make notes while reading new books? I feel like I'm going to forget a lot of stuff, but can't really figure out the important stuff
>>
>>65559506
>>65559510
>lul it doesnt matter that it's an unreadable mess, the fact that you can't easily translate it to a different set of instructions or syntax without throwing open a few manuals PROVES that C++ must be superior!!!
>>
>>65559547
C
void (*foo(void))(void);

C++
auto foo() -> void(*)();
>>
>>65559571
I'd rather read 5 lines than 500 lines of type unsafe non standard garbage full of macro abuses. Next time try not comparing apples with oranges
>>
>>65559546
>>65559556
>>65559585
Retards. You're spewing out bullshit for what is an assignment.
>>
>>65559571
If you want to demonstrate that C code is nicer than C++ code, try comparing them on equal terms. Otherwise you just look like a geriatric with an agenda.
>>
>>65559585
>non standard garbage full of macro abuses
projection
>I'd rather read 5 lines than 500 lines
it's a nice code golf challenge to try to fit the most logic into the least lines, but it's a terrible philosophy in real circumstances. id rather read more lines and understand it than spend the same amount of time trying to follow spaghetti shit sloppily smashed together into one long strand.
>>
>>65559613
>Projection
Basement dwelling neet detected. All real world C code ultimately devolves into a cesspit of macro abuse.
>>
File: 1520837008263.png (433 KB, 1440x1938)
433 KB
433 KB PNG
UFCS IN C++ WHEN
>>
>>65559623
Ah, a reverse card!
I'm afraid all I have left is a red 5. Fuck!
>>
>>65559632
ufcs is OO garbage anyway. If we never put methods second in the first place we wouldn't be having this dumb issue.
>>
File deleted.
>>65559491
See? You're doing it wrong.
That's now how you use modern C++ correctly.

Here's equivalent but modern code:
template <typename C, typename D, typename ...Args>
auto make_resource(C c, D d, Args&& ...args) {
auto p = c(std::forward<Args>(args)...);
using Ret = std::decay_t<decltype(*p)>;
return std::unique_ptr<Ret, void (*)(Ret*)>{p, d};
}


Clean and zero overhead.
>>
>>65559583
C++ one is still far better and easier to read
>>
File: Memri_395857_6288771.jpg (39 KB, 525x384)
39 KB
39 KB JPG
>>65559696
>ufcs is OO
>>
>>65559699
stop posting these lewd pictures, pedo
>>
File deleted.
>>65559699
>That's now how
not*

>>65559720
Anime website.
>>
>>65559726
Blue board.
>>
>>65559738
I didn't post anything against the rules.
>>
>>65559547
>>65559710
>>65559583
Haskell
type Foo = params -> ret
>>
File: 1515880240165.jpg (1.38 MB, 1000x1639)
1.38 MB
1.38 MB JPG
>>65559746
>slow
>bloated
>interpreted
>functional
Yeah, too bad it's 100% useless lmao
>>
File: 1523471017753.png (176 KB, 840x840)
176 KB
176 KB PNG
Newfag here I wanna learn how 2 code what/what are some resources to start?
>>
>>65559764
cry more
>>
>>65559764
>Haskell
>Bloated
>C++
>Not bloated
Uh huh.
>>
>>65559786
You can write an MBR in C++.
Can Haskell do the same? Didn't think so.
>>
Rate my readLn()
#include <climits>
#include <iostream>
#include <optional>
template <typename T>
inline auto readLn(std::optional<const char *> prompt = std::nullopt,
std::istream &input = std::cin,
std::ostream &output = std::cout) -> T {
T result;
if (prompt)
output << prompt.value();

do {
input >> result;
if (input.fail()) {
input.clear();
input.ignore(INT_MAX, '\n');
} else {
input.ignore(INT_MAX, '\n');
break;
}
} while (true);

return result;
}
>>
>>65559816
>Sepples
Automatic 0/10.
>>
>>65559699
>>65559726
uwu
>>
>>65559816
import Control.Applicative
readLn' prompt = do
mapM_ putStrLn prompt
let x = readLn <|> x
x
>>
>>65559816
>template <typename T> inline
>std::optional<const char *>
>auto -> T
but why
>>
>>65559876 >>65559816
With 1 extra import:
import Control.Applicative ((<|>))
import Control.Monad.Fix (fix)
readLn' prompt = do
mapM_ putStrLn prompt
fix (readLn <|>)

The type is
readLn' :: (Foldable f, Read a) => f String -> IO a

In your case, f ~ Maybe (aka Optional), but you can also use other containers like List (called []), in which case it prints every element
>>
In uni I'm taking two courses simultaneously where one is Java-based (Comp Sci 2) and the other is PHP-based (some webdev media course on creating a CMS to tick a box). I've never used PHP up to this point. Weak typing seems so...wrong. Am I an autist?
>>
>>65559897
Dynamic typing isn't bad if you're using a decent language, but weak typing like in PHP will fuck you over hard.
>>
>>65559180
if you're trying to spark an interest, i really recommend trying getting into programming through simple game development. you can start super simple (like a console text adventure) and just work your way up in complexity gradually (pong, tetris/match3, side-scrolling platformer, top-down shooter, etc). it makes it easy to set realistic short term goals; you can just take things one feature or bit of functionality at a time, and you can see the results of your work interactively and in real time, which is rewarding and helps keep up your motivation/momentum. there's lots of freely available learning material on implementing your own version of many of the classic/archetypal simple games. for a language, i highly recommend C#. it's a great first language; easy to learn and use but also surprisingly powerful/featureful at the fringes (low barrier to entry, high ceiling). on the chance you do end up pursuing a career in programming, being good with C# will put you in a nice spot; while Java is more popular overall (because it's been around longer and is on more platforms), C# adoption is quickly growing (because it's starting to support more platforms and it's just better), and C# jobs are generally better than Java jobs (which are almost always pajeet-core). I'd recommend MonoGame or SFML.Net for a framework. they're simple and intuitive but also don't excessively hold your hand, so you actually learn things. i'd avoid Unity because it basically encourages you not to learn by hiding everything away (often you're really only learning the "Unity way" to do something, which isn't very transferable, doesn't serve as a very good building block for learning, and isn't as rewarding as genuinely understanding how something works. and that's if you learn anything at all; the type of people that use Unity will often tell you to just "buy the plugin" for something that has countless free articles/tutorials/etc available and is easy to implement yourself. ugh)
>>
>>65559918
I guess you're technically right because there are no decent dynamically typed languages so the property holds.
>>
Trying to get Azure Active Directory authentication to work so I can access some APIs from Python. It's lame and I hate it.
>>
>>65559934
Most Lisps.
>>
>>65559918
>weak typing like in PHP will fuck you over hard
It seems that way. For instance (reminder I'm completely green in PHP) creating an array is as simple as
$testArray = array(1,2,3,4,5);

seems so wrong to me but is completely valid. What kind of array is it? How large is the array? What if I want empty elements? What about shrinking & growing it?
>>
>>65559939
So you don't have any, alright.
>>
how do I write a program to filter all reddit and blogposts itt
>>
>>65559180
>>65559926
also, while MonoGame itself does have books and tutorials and such available, i should note that any material aimed at the now-dead XNA 4.0 (there's a lot of it) will also work with MonoGame with only occasional/minor changes, because they're almost identical. MonoGame is just an unofficial/spiritual successor to XNA, only not limited to Microsoft platforms like XNA was. the backend is different but the interface is almost exactly the same, and the MonoGame documentation has a list of the few places where they differ slightly
>>
>>65559962
write a neural net that automatically replies "dumb frogposter" to dumb frogposters
>>
>>65559945
> What kind of array is it?
There's only one kind of array in PHP and it can hold any values.
>How large is the array?
How long is a piece of string? Use the count function to find out. It isn't a part of the type system.
>What if I want empty elements?
Then just don't give that index a value. PHP arrays are more like hashmaps than Java arrays, seeing as how the "indices" don't have to be consecutive (or even integers).
>What about shrinking & growing it?
Done automatically.
>>
>>65559962
You probably want to train a NN to recognise frogposters and le sad reddit man.
Also, analysing text for reddit spacing would be really easy.
>>
>>65559964
>>65559180
Rather than learning a specific language, do what you can to learn the theory behind software development. Yeah learning a language is important but the language should be the vehicle in which you learn how good software is written. You shouldn't simply learn a language to learn it.
>>
>>65559926
>a shekel has been deposites on your account
>>
>>65559982
>>65559969
filtered both of you to start
>>
>>65559962
add this guy to the filter
>>65559993
>>
>>65559979
That just seems too easy though and from what I've taken away from compsci so far, too easy usually meant I'm wrong.
PHP seems pretty neat so far though.
>>
they're all me though
>>
>>65555017
Gtfo /pol/
>>
>>65560007 (Me)
>>
>>65560004
Most dynamic languages are built in that "just don't think about it" kind of way. Javascript objects behave similarly, for example.
>>
>>65560009
Oh fuck this is /g/
>>
File: 1520047614749.jpg (154 KB, 643x720)
154 KB
154 KB JPG
Why didn't C++ properly namespace its own standard library?
For example std::vector<T> could be std::containers::vector<T>
std::optional could be std::variants::maybe
And std namespace should already be imported by default

For example if Im using a library, I put it's API header into a namespace of its own.
>>
>>65560097
C++ users seem to be strangely allergic to using declarations. Importing symbols piecemeal like literally every language ever works completely fine, I don't know why C++ is so resistant to the idea.
sepplesfags would bitch that they had to write
std::containers::vector
everywhere rather than adding one
using std::containers::vector;
at the top of the scope.
>>
File: clueless-frodo.jpg (89 KB, 400x399)
89 KB
89 KB JPG
I don't understand a single C++ code snippet in this entire thread
>>
>>65560004
It isn't too easy it's just more abstract. The "object" component adapts to whatever key-value pairs you throw at it automatically at runtime. You could write a C component that does that, couldn't you? So there. Easy to use but not magical. Downside is that less abstract, more specialized components are sometimes more efficient.
>>
>>65555323
What's with the CMake hype?
CMake is a clusterfuck.
>>
>>65560097
std::containers::optional
>>
File: 1518949762366.jpg (48 KB, 467x531)
48 KB
48 KB JPG
>>65560109
This is because there's no import system in C++. #include will blindly copy and paste between translation units. You cannot have private imports in C/C++.

Hopefully C++20 modules fixes this.
>>65560134
Better than nothing (read: autotools)
>>
>>65555354
>co_routines (LITTERALY a 10 LINE GCC PATCH)
elaborate
>>
>>65560145
explain?
>>
>>65560156
what
>>
>>65560145
Fortunately that's only a problem in headers. I guess you can use hacks like detail namespaces though.
>>
>>65560145
modules aren't coming until 2026 and they're going to propagate macros and somehow manage to slow down compilation
>>
What is the advantage of using an anonymous namespace over the static keyword in C++?
>>
>>65560196
>modules aren't coming until 2026
source?

I intend to start a large project in C++. Even Rust will become more usable by that time.
>>
File: GabrielDropout 81 (JA).jpg (302 KB, 1277x1684)
302 KB
302 KB JPG
https://izzys.casa/posts/millennials-are-killing-the-modules-ts.html

oof
>>
Beginner to python here. I have function, B, which calls another function, A, many times. Each time it is called, function A gets some input values from B. Function A uses these values and also prints them so I can keep track.

Is there a way for me to get function A to print how many times it has been called? I cannot change B as it is a module, but A I write myself.
>>
>>65560215
>Fortunately that's only a problem in headers. I guess you can use hacks like detail namespaces though.

>global var "counter"
>in A: counter = counter + 1
>print counter
>>
>>65560215
Yup. Just use a counter
n_A = 0
def A(foo):
global n_A
n_A += 1
... foo ... "whatever"

B (...)
print(f"A called {n_A} times")


But that's a little bit more advanced than what you've already seen I would guess
>>
File: comic sans.png (36 KB, 937x933)
36 KB
36 KB PNG
Which is the best & worst font for programming?
>best
Consolas
>worst
Comic sans
>>
>>65560313
>best
Haskell/ML/Agda
>worst
Python/Ruby/Bash
>>
>>65560313
Comic Sans is quite fitting for C++.
They're both horrible memes.
>>
File: 1351077624862.png (763 KB, 1312x1014)
763 KB
763 KB PNG
>>65560331
>font
>>
>>65559491
christ, retards keep reposting this shit even though the worst part (the trailing return type) hasn't been necessary since C++11. and there's a typo ("ReturnTypeReturnType"). it seems you also fail to understand that this does something highly generic/applicable, so a bit of verbosity/complexity is a very small price to pay

>>65559506
>>65559510
equivalent C code is impossible. what this function does is take the usual idiomatic creation/deletion function pair for a C library type, and a set of arguments for the creation function, and returns the pointer given by the creation function and (perfectly forwarded) arguments wrapped in a unique_ptr which automatically calls the deletion function on the contained pointer when it is nulled/reset, reassigned, or goes out of scope without being moved to another scope. essentially, it adds the lifetime and move semantics of unique_ptr to a C library type (even though such types obviously don't have actual constructors or destructors) without the need to create a distinct/arbitrary C++ wrapper type. the whole point of it is specifically to add a major functionality (tying lifetime safely and automatically to scope, with move semantics no less, and without overhead to top it all off), which C fundamentally can not do. and it does it for basically any C library type, with a single call, to a function a few lines long
>>
File: low.Akarin 102.png.jpg (76 KB, 416x990)
76 KB
76 KB JPG
>>65560556
trailing return type is cooler though
>>
>>65560556
The whole thing was originally about aesthetics, so I don't know why you're bringing that irrelevant shit up.
C++ is fucking ugly, and I don't know how you could possibly argue otherwise.
>>
>>65560556
>equivalent C code is impossible
Well no not impossible. You could generate this code.
But I'm sure if you're reading your post back to yourself you'd realize several ways of doing what needs to be done in a particular situation that's way simpler than what's proposed. That's what you do in C normally.
Overcomplicating things is not a good thing.
>>
>>65559699
>>65559726
Thx I just got promoted
>>
File: 1514206862309.png (283 KB, 397x484)
283 KB
283 KB PNG
>>65555017
>C++ is a high level language, and as all high level languages, it is designed to make coding easier and human readable
>>
Trying to figure out what the best way to implement search is. Do I need to use Solr or is there some simple way to build a sane search system using my existing SQL database? I'm guessing the former...
>>
File: 1519339885856.png (22 KB, 485x443)
22 KB
22 KB PNG
>>65555449
Double the boilerplate in half the space.

Genius
>>
File: 1465297400484.jpg (100 KB, 500x500)
100 KB
100 KB JPG
>>65560430
>>
>>65560869
stop drooling
>>
>>65558553
>>65558677

rekt
>>
File: 1509563184410.jpg (20 KB, 450x210)
20 KB
20 KB JPG
>>65559491
>>
>>65560563
in cases like this where it's highly dependent, it's just error-prone. more trouble than it's worth

>>65560568
that really depends on the complexity of what you're trying to do. kind of the point is that you can write something complex once and it's much less complex to actually invoke the functionality from then on (and it's applicable in more of the use cases where it really ought to be, which eliminates redundancy, which is both ugly and error prone). it kind of figures that, for example, widely applicable generic code that plays nicely with a large set of semantics/features would end up being a bit complex at times because it's going to have to inform or specialize on or respond to aspects of those semantics/features in some way or another (or at least be allowed to when some default functionality isn't appropriate), and each of those aspects it works with intuitively/correctly essentially increases the overall "correctness" of the functionality toward some theoretical upper limit (basically expanding one of the dimensions of the space of well-formed/behaved use cases) which should ideally be one that emerges from the essential nature of the functionality itself and not be arbitrarily constrained by limitations of the language. that's obviously going to require some added syntax somewhere, sometimes. that, or a language/implementation will make general sacrifices in one or more aspects (efficiency is a common one) of the capability or correctness of any or all of the programs it generates, in exchange for some or other reduction in local syntactic/semantic complexity. that's not really beauty or elegance, it's weakness. whatever you want to call it, it's a tradeoff. but an "ugly" once-written function which does something nontrivial for a large space of use cases, correctly/intuitively, with no overhead is a beautiful thing to me
>>
File: 1522794867209.jpg (27 KB, 400x433)
27 KB
27 KB JPG
Is it possible to get CMake completion in vim? Preferably populating a ycm style popup with matches, or just a buffer. The syntax is a fucking pain to remember.
>>
>>65561175
nevermind, omni completion
>>
>>65558652
>>65558652
Well the Chip-8 is basically a programming language that consists of 30~ opcodes. The max memory size is 4k and the program loads in at 0x200. Writing it in Racket but want to try Haskell too.

Currently I read in a Chip-8 ROM like Pong or Tetris a byte at a time and store it in a hash-table of 4095 elements. The keys are converted from hex so 0x200 becomes the 512 key.

I load the bytes from 512->eof

The Chip-8 has 5 special registers followed by 16 general purpose ones. For the 16 I create another hash-table and access them with something like (vx 0) = Vx0 (first register) and set them with (vxc 0 val).

After that all that is needed is to point the program counter to 0x200 and run through the bytes. An opcode is 2 bytes and there are only a few that have a static pattern like 0x00e0 and 0x00ee, for the rest I have to match parts of the opcode using an hierarchical match statement and then write the code for it based on the specifications.

At the moment I've been developing by running the program and then seeing where it stops by saying there's no opcode that matches, writing it, and then repeating.

The tricky part is I'll have to figure out a good way to have it write graphics data in a format I can hookup to different backends.
>>
>>65561220
Some statements only rely on the first byte to be unique.

Like

0x1nnn
0x2nnn
0x3xnn

This is part of the code for how I'm handling that atm.
>>
>>65561243
>bytecode interpreter vm
why don't you write a COMPILER like a PROFESSIONAL would
>>
>>65561277
a REAL PROFESSIONAL would create his own computer
>>
>>65561311
a REAL PROFESSIONAL doesn't know what is a computer.
>>
>>65561277
>>65561311
A REAL PROFESSIONAL just writes a kernel for an existing platform with an existing compiler.
>>
>>65561352
lying cia nigger
>>
File: 1521315663452.png (386 KB, 1436x1652)
386 KB
386 KB PNG
>>65561352
>not creating your own universe
>>
File: IMG_20170922_140500.jpg (206 KB, 982x1200)
206 KB
206 KB JPG
>utf-16
Ok, micrshills, explain yourselves.
>>
>>65561427
if only it were just microsoft.
java, c#, qt, ncurses, and special mention for the fucking ICU itself
>>
>>65561427
2 bytes encoding better than utf-8 for what it is worth (all unicode) and is used in modern languages and also effected by endian-ness.
>>
>>65561469
oops it is 4 bytes for all unicode srry and 2 for bmp
>>
>>65561469
fix you, UTF-8 works perfectly well, it's also what the entire internet uses.
>>
>>65561512
The internet was a mistake.
>>
>>65555604
That's too big of a project. Use an existing RDBMS.
>>
>>65555785
Remove C, Java, and ASM from this list and I agree.

>>65557056
Local variables in C# are camelCase.
>>
>>65555017
>reddit in op
>no anime in op
>>>/trash/reddit
>>
Custom colorpicker for a game ui.
>>
>>65561518
agreed, and UTF-16 was an even bigger one.
>>
File: giphy(2).gif (371 KB, 428x238)
371 KB
371 KB GIF
>>65561601
YOU TAKE THAT BACK!
>>
>>65561558
How can you recommend C# as a beginner language ?
How can you actually be this much of a shitstain to think that it is somehow more suitable than C?
How can you then be this much of a hypocrite to not recommend Oracle# afterwards ?
>>
File: p.png (146 KB, 822x760)
146 KB
146 KB PNG
>>65555604
cjdate is the reference in that field.

https://en.wikipedia.org/wiki/Christopher_J._Date

his book An Introduction to Database Systems is the best.
>>
>>65561277
Dynamic recompilation support nigga.
>>
>>65557781
it's the ugliest language imo tbqh desu
the only good thing about it is that it has classes but that's it -- everything else is shit
>>
>>65557781
transiting from C to C++ is like evolving to the next pokemon
it makes you a stronger programmer but you need a decent amount of experience points in the previous language in order to manage it
>>
I have a long python numpy script for some numerical simulation. nothing vectorized because it's just a proof of concept for a later C implementation
Pretty CS grad meme trier but anyway.
What's some good practice for this kind of simulation?
>>
New thread:
>>65561763
>>65561763 >>65561763
>>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763 >>65561763
>>65561763 >>65561763 >>65561763
>>65561763 >>65561763
>>65561763
>>
File: metal.png (18 KB, 678x256)
18 KB
18 KB PNG
Anyone have any experience with this?
>>
>>65561674
You can write perfect, idiomatic C++ using only c-style structs. Read From "Mathematics to Generic Programming" to see the beauty of the (best subset of the) language and where it's headed. The syntax may look ugly at times, but so will a research paper to the uninitiated. Java style classes in C++ is a red flag that the author does not understand the language.
>>
>>65561785
Yes. Its pretty neat.
>>
>>65561787
retard
>>
>>65557217
Just use goto fail if you're doing C-style error handling.
>>
>>65557217
#define TRYFAIL(errvar,err) {\
errvar = (((err))); \
if (!SUCCEEDED(errvar) { \
goto fail; \
} \
}
[\code]

And just use TRYFAIL(hr, <whatever your error code comes from>) to go to your fail label automatically.




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.