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

/dpt/ - Daily Programming Thread

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

Thread replies: 313
Thread images: 39

File: 1458747449654.png (717KB, 1000x793px) Image search: [Google]
1458747449654.png
717KB, 1000x793px
Prev: >>58608998

What are you working on, /g/?
>>
>>58611896
First for C
>>
>>58611909
#include <stdio.h>

all I've learned. Why not C++?
>>
>>58611913
C++ is a terrible language.
>>
>>58611913
>but C++ came out after C so it must be better
>>
File: ....jpg (17KB, 480x270px) Image search: [Google]
....jpg
17KB, 480x270px
>>58611896
Thank you for using an image!!!
>>
 
Private Sub Document_Open()
Beep
MsgBox "You should disable macros."

End Sub
>>
>>58611913
http://harmful.cat-v.org/software/c++/
>inb4 a pretend economist comes and praises c++ for creating (private industry) jobs
>>
>>58611896
>>58611859
yeah, I can see that. My rule of thumb is that I can't post here unless I actually talk about something interesting I am doing (or in reply to somebody else asking a question, going to start taking this seriously).

The last person to join the IRC let me port it over to SPARC through VNC, so i'm hoping to find more people helpful like that.
>>
File: 657d66649c.png (9KB, 600x400px) Image search: [Google]
657d66649c.png
9KB, 600x400px
>>58611896
Adding some features for my task manager, gonna add a pomodoro timer next.
>>
>>58611904
well thats why I went IT instead of CS lmao. Maybe I should have went MIT but its too late now
>>
>>58611975
>there's no tasks
maybe work on your grammar first, laddo
>>
File: 1475938307196.jpg (7KB, 250x241px) Image search: [Google]
1475938307196.jpg
7KB, 250x241px
>>58611975
>look at my todo app guys episode #44 (rerun)
>>
>>58611988
What's the error senpai? I'm not a native english speaker.
>>58611989
Yeah, totally boring, but I wanted to mess with SQL a bit more.
>>

#include <stdio.h>

int main(void)
{


int i;
for(i=1; i<=100; ++i)
{
if (i % 3 == 0)
printf("Make");
if (i % 5 == 0)
printf("America");
if (i % 7 == 0)
printf("Great");
if ((i % 3 != 0) && (i % 5 != 0))
printf("Make America Great Again");
printf("\n");
}

return 0;
}
>>
>>58612006
there is (singular)
there are (plural)
which one is (tasks)???
>>
>>58612008
you forgot (i % 7 != 0)
>>
>>58611859
just remembered that the other guy in the IRC channel has been posting some stuff about it and how the porting to SPARC was going, so it isn't all me in the first place
>>
>>58611913

The cons for C++ can be summarized as follows:

1. MUCH more complicated for beginners due to an overabundance of language features, and a general need to understand how those language features work to understand best practices.
2. Programs take longer to compile because of templates, and depending on your compiler, may produce some rather incomprehensible error messages.
3. May not target as many platforms as C (embedded platforms), may have issues with ABI backwards compatibility, or compatibility between different compilers on the same platform (MinGW, MSVC++).
4. General disapproval of certain subsets of C++'s language features, depending on which language the complainer comes from (some don't like OOP, some don't like templates, some don't like exceptions, etc...)

Overall, it's a language designed by committee, that is constantly evolving, which can be incredibly useful to a power user and incredibly confusing to anyone else.

>>58611989

The best TODO app is Habitica.
>>
File: 1484338272114.png (134KB, 439x519px) Image search: [Google]
1484338272114.png
134KB, 439x519px
>>58612016
Got it.
>>
>>58612037
>May not target as many platforms as C (embedded platforms)
is that really a language issue? sounds more like an implementation issue
>>
Someone name me a mid size project that can be a good time waster thar will also exercise my brain.

Or share your projects so we can all contriboot.
>>
>>58612058
Implementation issues are language issues.
>>
>>58612066
Chess engine.
>>
File: Go.png (3KB, 441x441px) Image search: [Google]
Go.png
3KB, 441x441px
>>58612066
>>58612066
>>
>catch on to ideas
>understand OOP, Loops, Arrays
>Given Java programming assignments from my uni
>spend hours being overwhelmed trying to figure out the program
>ask for help

Did you guys go through this when you were new? It's incredibly demoralizing.
>>
>>58611968
>http://harmful.cat-v.org/software/c++/I_did_it_for_you_all
fake news
>>
>>58612118

I learned to program before going to university, and most of my assignments were pretty easy to do because of that.
>>
>>58612037
2 the win factor of using templates for the lost of compilation time is really big
3 can be avoided if you know you're targetting embedded from the get go
>>
Clang vs gcc?
>>
>>58612118
what are the things you were asked to do?
>>
>>58612147
clang
>faster to compile
>better warnings
gcc
>freer license
>guaranteed to work with everything

they both produce around the same speed code
>>
>>58612147
gcc
>>
>>58612147
I use gcc, I've always used gcc. I will keep using gcc until I have a reason not to.
>>
>>58612160
>they both produce around the same speed code
Historically, GCC has been better, because it's a more mature compiler.
I still think GCC is still slightly faster in most benchmarks.
>>
>>58612160
>>faster to compile
http://baptiste-wicht.com/posts/2016/12/zapcc-cpp-compilation-speed-against-gcc-54-and-clang-39.html
>>
>>58612143
I should've but I was an immature kid. Now I'm stuck studying 40 hours/week minimum on math classes and this programming course.

>>58612148
Stuff like creating a maze in a 2D array and creating a maze runner that solves any maze by keeping right. Counting multiple random generators and storing them into an array, then finding the percentage of answers by total number of answer. I feel like I should be able to do this stuff with ease and it kills me that I can't.
>>
>>58612160
>gcc
>freer license
>when clang is fucking BSD-style
pls
>>
>>58612181
That sounds about right
>>
>>58612037
I think bigger than all of that is that they forster an idea of performance programing that distances itself from hardware in ways that are completely unnatural. Every abstraction they have is there to avoid you being platform specific. So when you need to use the language for what you generally use C or C++ for you have to struggle a lot. For instance if you care about memory alignment, as you often do, you have to start using your own allocator and not the 'new' in C++. You'd think telling C++ 'hey start associating all my new calls and delete calls to this allocator instead' would be easy and efficient but it really isn't. You overload the operator new per type.
Similar problems are all over the place. With its promise of being very open to your style of programming (multiparadigm, has tons of facility to express yourself) it all tends to be extremely difficult to work with to get anywhere. It's similar for most details you may care about, a lot of work to get done. Some blame C legacy but I think it's mostly about C++ legacy at this point.

It's also important to note that the C approach of just writing functions that do just what you want and calling those (also available in c++ obviously but should you use C++ because its similar to C?). It's a more attractive proposition to go that route. And unless you're programming alone you're at risk of other people using the C++ that's inconvenient to work with.

If C++ had some proper constraints you could place on programmers it'd be great. Now many industries rely on external tools to manage their programmers. It's not what you expect of a programming language as inconveniently big as C++. That you need more tools than they offer to get good code.
>>
>>58612132
It's mostly quotes you can find everywhere.

I'd say the quote Dijkstra made about California is a bit misleading because it was not intended to spite. Though he did write a letter pleading for his university not to teach C++.
>>
>>58612234
He wrote one pleading not to teach Java, don't know about C++
>>
>>58612181
>historically
Really? Clang is really new and its been better for most of its life.
I'd say unless your platform only has GCC or has poor support for clang (is that still the case for Windows?) go with clang.
>>
>>58612212
>For instance if you care about memory alignment, as you often do, you have to start using your own allocator
how is that different from C?
>You overload the operator new per type.
at least you have the option to do that instead of having to use different functions for it in C
>>
>>58612274
I don't think you get my point. And the 'at least you have the option.. ' makes me not want to explain further.
>>
>>58612253
>shilling this hard
clang is mostly worse or roughly on par with gcc
>>
>>58612239
I'm misremembering.
When pleading for them not to teach java he also said
"—usually it turns out that their undergraduate curriculum has not recovered from the transition from Pascal to something like C++ or Java."
That's probably where I got it from.
>>
>>58612191
gotta restrict freedoms to maximize freedoms
>>
File: joes.jpg (451KB, 1277x668px) Image search: [Google]
joes.jpg
451KB, 1277x668px
guys my code is literally 316ms too slow to pass the challenge. what do?

12000ms allowed

def sum_pairs(ints, s):
firstpair = ()
secondcheck = []
returnnone = True

for i in ints:
sliced = ints[ints.index(i) + 1:]
for index2, x in enumerate(sliced):
if i + x == s:
returnnone = False
secondcheck = ints[ints.index(i):index2 + ints.index(i) + 1]
firstpair = i, x

for i in secondcheck:
sliced = secondcheck[secondcheck.index(i) + 1:]
for index2, x in enumerate(sliced):
if i + x == s:
secondpair = i, x
return ([i, x])
if returnnone == True:
return None
return (list(firstpair))



the list of integers has 10,000,000 elements
>>
>>58612417
cython
>>
>>58612417
Stop writing it in memesnek
>>
>>58612417
You're wasting a ton of time searching, making slices, and enumerating them when you could just have a nested loop.
>>
perl and c are the strongest languages
>>
>>58612431
>Perl
Nobody uses that ugly shit anymore, granddad.
>>
>>58612430

huh you're right

I'm gonna try to rework it
>>
>>58612417
Get a better computer?
What kind of moron doesn't measure in microops?
>>
>>58612185

>zapcc
Oooh, new compiler to keep an eye on.

>>58612212

1. Platform-specific anything doesn't belong in a language spec. Alignment on addresses more fine than 8-byte aligned isn't common except for some SIMD things, in which case you're probably going to only need one or two different struct types to make a different operator new for.

2. High performance computing and retards don't mix. If you need to manage a bunch of idiots, clearly they shouldn't be working in C++ in the first place.

>>58612431

Perl is gross.
>>
>>58612434
i'm not a dude also i'm 23
>>
>>58612436
Make sure you loop through the indices and not the elements themselves, then you can just do i+1 without searching.
>>
Go sucks
>>
>>58612460
go more like go away
>>
>>58612447

Clearly a figure of speech, Anon.
>>
>>58611896
>Anzu Futaba
Thanks OP for being based as fuck.
>>
>>58612447
LONDON
>>
>>58612446
>1.
A language intended to make performance oriented code easy to work with should have the facility to put platform constraints into your code easily. What I wrote is an example.
>only a couple structure types
Depends. If you want to couple code together a lot you can get away with very little.
The C approach would just be giving you an aligned pointer of appropriate type though. It's a homogenous solution.
>2.
Well we can't exactly choose how good programmers are. We don't live in an ideal world. If we could just choose this language choice is fairly irrelevant. We'd just put someone on writing nice tooling for brainfuck.
>>
>>58612463

#!/usr/bin/env perl
length q bless glob and print chr oct ord q mkdir m and print chr ord q xor x and print chr ord q q q and print chr ord uc q map m and print chr ord q qw q and print chr ord q each le and print chr ord q my alarm and print chr oct oct ord uc qw q for q
>>
>Zapcc is a c++ compiler, based on Clang which aims at being much faster than other C++ compilers. How they are doing this is using a caching server that saves some of the compiler structures, which should speed up compilation a lot.
this is what ccache should have been. ccache is fucking dumb
>>
>>58612503
Why?
It'll be worthless once modules are out.
They'll need to change everything.
>>
>>58612503
Seems kinda pointless when we get modules.
>>
File: 5b54e83afe5e37abaa08b28761a34749.png (374KB, 630x1000px) Image search: [Google]
5b54e83afe5e37abaa08b28761a34749.png
374KB, 630x1000px
If you are going to put some stuff in a namespace, do you do it inside the .h file or the .cpp file?

//.h file
#pragma once
#include <shit>

namespace haha {
const variable x = value;
void functionD();
}


OR

//.cpp file
#include <shit>

namespace haha {
variable x = value;
void functionD() {
//does shit
}
}
>>
>>58612493

>Well we can't exactly choose how good programmers are. We don't live in an ideal world. If we could just choose this language choice is fairly irrelevant. We'd just put someone on writing nice tooling for brainfuck.
If you run a company, you can filter away the retards that can't do C++ well in the hiring process.
>>
>>58612518
And then we're understaffed.
>>
>>58612516

Whether global or in a specific namespace, declarations in the header, definitions in the source file.
>>
>>58612516
I write everything in h files so why bother?
>>
File: compiling.png (28KB, 413x360px) Image search: [Google]
compiling.png
28KB, 413x360px
>>
>>58612534
Not an answer, I knew that already


>>58612549
haha
>>
Books for SQL?
>>
>>58612562
haha XD
>>
>>58612562
This is a C++ exclusive feature now.
>>
>>58612580
...
>>
>>58612587
Jealous?
>>
>>58612562
When does compiling ever take more than a few seconds or minutes at most?
>>
>>58612593
When you aren't building fizzbuzz
>>
>>58612580
Scala makes C++ look like assembler when it comes to compilation time.
>>
>>58612604
Scala makes C++ look like Haskell when it comes to concise code
>>
>>58612593
It really doesn't take long in most cases.
But certain code bases are just plain awful.

It's not like its an excuse to slack of anyway and I'm sure everyone really hates long compile times.
>>
>>58612593
Re-instantiating the same C++ template for the 50,000th time.
>>
>>58612563

>Not an answer
It means your namespace shit goes in both files, idiot.

// foo.h
#ifndef FOO_H_
#define FOO_H_

namespace Foo {
int bar(int x);
}

#endif

// foo.cpp
namespace Foo {
int bar(int x)
{
return 2 * x + 3;
}
}
>>
int main(int argc, char *argv[])
{
char *i;
for(i = 0; i < 0xFFFFFFFF; ++i)
{
*i = 0;
}

return 0;
}


Give me ten million dollars or I run this on all your machines
>>
>>58612659
Ah ok

Can you tell me why that is though?
>>
>>58612669
Considering it will likely segfault on the first iteration, I think I'll keep my 10 million dollars.
>>
>>58612669
>32-bit address space
>Comparing a pointer to an integer
What year is this?
>>
I'm using code academy right now to learn java.
Good move? I want to possibly get into arduino style coding or make use of raspberry eventually. This is just kind of a hobby for me I'm actually a biz major . I just realize the importance of tech in the future and want to learn a bit while I'm still young.
>>
File: doit.jpg (181KB, 634x635px) Image search: [Google]
doit.jpg
181KB, 634x635px
>>58612694
>>58612695
Do you think I'm joking
>>
>>58612704
>code academy
no

https://docs.oracle.com/javase/tutorial/
>>
>>58612669
>>58612694
main.cpp: In function 'int main(int, char**)':
main.cpp:6:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
for(i = 0; i < 0xFFFFFFFF; ++i)
^~~~~~~~~~

exit status 1
>>
>>58612669
I hope you realize the worst this could do is clear the RAM, not the disk.
>>
File: 1452403462016.png (79KB, 307x400px) Image search: [Google]
1452403462016.png
79KB, 307x400px
>>58612714
>C++
Get a load of this stupid faggot.
>>
File: 28_hour_day.png (62KB, 740x349px) Image search: [Google]
28_hour_day.png
62KB, 740x349px
does the 28-hour day actually work?
>>
>>58612726
haha XD
>>
>>58612726
i do something like that naturally, sleep 6 times a week
>>
>>58612726
>le xkcd
XDDDD
>>
>>58612669
> Segfaults AND has a warning
Wew, very scary
>>
>>58612674

Header: There is a function somewhere called Foo::bar with type signature int(int) somewhere, probably in another compilation unit.
Source: Export this function, call it Foo::bar and give it the type signature int(int)

Namespaces don't change anything about how compilation and linking fundamentally works. They just change how the name gets mangled. When you do something like "using namespace Foo;" you're basically saying "If we don't try this identifier bar somewhere in our declarations, try Foo::bar before deciding to throw an error."
>>
File: ballmer_peak.png (91KB, 652x592px) Image search: [Google]
ballmer_peak.png
91KB, 652x592px
i KNEW it!
>>
File: tumblr_mjkfjrIFyZ1s8r2c1o1_400.jpg (17KB, 335x378px) Image search: [Google]
tumblr_mjkfjrIFyZ1s8r2c1o1_400.jpg
17KB, 335x378px
>>58612669
>trying to dereference a null pointer
Wew lad.
>>
>>58612726
try it and find out
I'm sure your boss won't give a shit if you leave at fucking 1pm on monday
>>
>>58612726
How about you sleep when you're tired and stay up when you're not? Leave the thinking to someone else. Like your brain.
>>
>>58612714
>>58612720
>>58612751
>>58612763
Last warning
gcc -o virus virus.c -O2
>>
>>58612765
This is /dpt/. I'm sure most of us have flexible schedules.
>>
File: fbi.png (77KB, 980x266px) Image search: [Google]
fbi.png
77KB, 980x266px
>>58612771
>>
>>58612762
Remember to use ethanol vapour for more accurate dosage than drinking.
>>
>>58612762
XXXXXXXXXXXXX
DDDDDDDDDD
>>
>>58612774
if you're a neet, then you don't really need an esoteric sleep schedule to get good rest
furthermore, you don't need good rest because you're not doing anything that requires effort or alertness
>>
File: 1460359321842.gif (33KB, 181x222px) Image search: [Google]
1460359321842.gif
33KB, 181x222px
/dpt/ please tell me what C static analyzers and/or debugging tools you use, maybe what you like about them too. My toolset is nothing other than clang right now and I need to improve.
>>
>>58612771

#!/usr/bin/env ruby
File.unlink 'virus'
>>
>>58612782
>Remember to use ethanol vapour for more accurate dosage than drinking.
more info please
>>
>>58612791
Programmers often have flexible schedules anon. Both my parents did. They had some meetings but aside from that they could work whenever they wanted whatever they wanted.

I guess if you're just a pajeet it's different though.
>>
>>58612801
gdb and Valgrind.
>>
>>58612609
>concise code
are you trying to write imperative style in a functional language?
>>
>>58612801
>I need to improve
Clang-analysis is nice.
What do you feel you're lacking?
>>
i just want to say thank you to all the EETs here on 4chan.
PAJ EET
N. EET
E.L. EET
Trappy F. EET
etc...
>>
>>58612417
god this dude bugs me. I'm fat too but this guy is so shameless about it. Ugh, I hope he doesn't have one of those purply swollen pussie beetus legs. That shit is so sad to see.
>>
>>58612831
what?

i'm saying scala is verbose
>>
>>58612807
No you will just hurt yourself anon. These secrets are only for expert programmers like Linus, RMS and 4chan.
>>
>>58612807
you will die an agonizing death as your lungs feel like they are on fire, the cells die from alcohol poisoning and you suffocate
>>
>>58612808
yeah, everyone who is a programmer is a silicon valley unicorn that gets to work whatever hours they want
>>
>>58612710
Thanks senpai. So is java good starting off with?
>>
>>58612860
small projects and independent developers usually do
>>
>>58612860
Everyone is a stretch but it's very common here.
I hope you're not seriously idealising silicon valley though.
>>
>>58612862
yes

/g/ memers will tell you otherwise but imo java is the best to start with. the top languages like java/C++/C#/C are ok to start with. stay away from python and haskell
>>
Reposting from /sqt/
Okay what the actual fuck is going on here?

I drag-drop a python file (for which I have execute permissions) onto terminal and when I run it, I get the manual page for "ImageMagick" (a library I downloaded for some C++ project. Nothing in my python file uses that library)... What the hell, terminal?
>>
>>58612869
>small projects
Mom recently got bought up by GE. She has had it this way for about 19 years now. And I wouldn't say it was small at any point.
>>
File: happypig.jpg (142KB, 724x950px) Image search: [Google]
happypig.jpg
142KB, 724x950px
Im tempted to use the unsafe class in java. however, there is a rumour that it will be removed in java 1.9 and it probably is much future proof to just use jni. but that's slower. what do?
>>
>>58612880
silicon valley is where alternative management techniques are in vogue, very few of which are ideal
>>
>>58612899
use jni. the overhead for a jni function call is on the order of ~20 cpu cycles so if you're doing any significant amount of work the jni overhead will be almost nothing by comparison
>>
>>58612897
>mom got bought by GE
I meant her company. GE is making itself very clear that they're taking a strong stance against corruption and unlawful behavior such as slavery.
>>
>>58612890
Your python script is probably calling imagemagick but with incorrect or non-existent parameters and doesn't handle the output itself.
Search the file for imagemagick
>>
>>58612817
>>58612832
Thanks.

>What do you feel you're lacking?
Anything. I meant clang the compiler, not the tools with it. I haven't tried them out yet.

Particularly I was wondering about linters or things that can catch obvious bad patterns beginners may make, or something to display shorter syntax for the same operation. Like
*(*(*3Dptr+3)+1) being simplified to (*3Dptr)[3][1]

I will check out the clang-analysis and other clang tools.
>>
>>58612949
Clang-format is a godsend.
Don't forget that one.
>>
>>58612913
exactly. for primitive operations unsafe is 9ns faster (according to some guy on so). how can jni even compete
>>
1B 29 30 1A E0


This in ASCII will fuck your terminal session. I don't know why.
>>
Why can't a user program reference address 0 anyway? It should be fine since they're inside their own data segment anyway

Does the OS hide deep, dark secrets down there?
>>
>>58613329
That's where they keep their hot glued figs
>>
>>58613329
Who says it can't? C?

C doesn't make the rules
>>
File: Untitled.png (162KB, 1920x1040px) Image search: [Google]
Untitled.png
162KB, 1920x1040px
IDA hurts my brain.
>>
>>58613215

Well, the first of these bytes is '\e', the escape character. Typically, the character that follows that is a '[', however it seems this one is followed by a ')' instead, meaning it's not using a standard CSI escape code. This is hard to find documentation for, but I found this:

http://www.inwap.com/pdp10/ansicode.txt

The \e) combination seems to suggest that it's fucking the character set. Not sure what the fuck is supposed to come after that though.

>>58613329

Because enough commonly used languages define address 0 as invalid that it's pretty common for operating systems to just mark it as an invalid page.
>>
>tfw I have drank 11 cartons of soy milk this month when programming

SOMEONE STOP ME
>>
>>58613417

Just drink regular whole milk. Goddamn.
>>
Trying to find similar functionality like a map for a linq statement. I'm FP memeing.
>>58613417
>soy milk
How do you even get milk from soy, do you even GOMAD?
>>
>>58613423
regular milk tastes gross to me
>>
>>58613425
select should be map
>>
>>58613417
you'll stop when you grow tits.
or maybe you drink more to make them bigger.
>>
>>58613404
I'm curious about the last character. SO.

I found out it works without the 1A. The first three characters let the SO do the trick. Yet don't know why.
>>
>>58613404
>Because enough commonly used languages define address 0 as invalid that it's pretty common for operating systems to just mark it as an invalid page.
Meme languages if you ask me
>>
>>58613448
soy milk and estrogen is a dumb connection
>>
>>58613460
wanna bet?
>>
>>58613468
the study wasn't done on normal people

regular milk from the store is more likely to have estrogen in it
>>
>>58612191
>cuck license
>free
>>
File: bac00791b0.png (5KB, 578x127px) Image search: [Google]
bac00791b0.png
5KB, 578x127px
>>58613446
Almost there, I guess. Gonna review lambdas' syntax.
>>
>>58613489
gotcha
>>
File: Untitled.png (34KB, 747x843px) Image search: [Google]
Untitled.png
34KB, 747x843px
Explain to me why this is happening please
>>
>>58613552
you don't have the executable in your PATH
>>
>>58613552
Well, clang can't find the file
I can tell you it's not in your C++ directory
>>
>>58613552
>>58613569
wait im a fucking idiot, i somehow read that as the standard "not recognized as an internal or external command" error
>>
File: Untitled.png (56KB, 831x972px) Image search: [Google]
Untitled.png
56KB, 831x972px
>>58613579
lmfao I'm fucking RETARDED
>>
What languages aside Python support dumb programming?
>>
>C++
https://www.youtube.com/watch?v=rWDNwN0h0LM

>python
https://www.youtube.com/watch?v=rkcXRBhYZHU
>>
File: wtf.png (32KB, 758x900px) Image search: [Google]
wtf.png
32KB, 758x900px
1 last thing:

the return5() function is declared in the header file but I don't know how to make it compile the two files together
>>
>>58613682
You have to #include the header in your C file.
>>
>>58613710
Ok but lets say that I had three files:


Test.cpp //it will just use a function defined in Doo.cpp
Doo.h //Declares a function
Doo.cpp //Defines the function


How will I get this to work?
You don't include cpp files.
>>
File: 009719984b.png (3KB, 603x29px) Image search: [Google]
009719984b.png
3KB, 603x29px
>>58613446
Fugg, you were right, thanks anon.
>>
>>58613755
Include doo.h in test.cpp
>>
How do I start documenting instead of procrastinating it?
>>
>>58613755
Find a better tutorial. Or better yet, read a damn book about it.
>>
>>58613811
Put on some music and get at it
https://youtu.be/p6eC8C-K1Vs
>>
File: wtf.png (14KB, 699x91px) Image search: [Google]
wtf.png
14KB, 699x91px
Linker won't work now.

>>58613824
I'm reading this http://www.learncpp.com/
>>
>>58612939
I'm not importing ImageMagick, nor am I calling any of its methods within the code... The most I'm doing is opening a file.

Also, my cron isn't working
>>
>>58613845
You need to tell the linker what libraries to link, it's telling you the name there.
>>
>>58613436

It needs to be whole milk, not that retarded 2% shit. Lactose is a sugar. Higher milk fat content = higher sugar content = better taste.

>>58613453

Switch character set
Print character that character set can't handle
Terminal session gets fucked.
>>
>>58613460
>>58613479
soy has a lot of phytoestrogens

milk from the store also has a lot of estrogen but at least it has high quality protein
>>
File: butt.png (4KB, 719x392px) Image search: [Google]
butt.png
4KB, 719x392px
>>58613845
>>58613873
And make sure you actually have the library to link with too. I don't know why you'd need that library if you're using clang though, unless you're specifically including <windows.h>.
>>
>>58613935
'A 2010 meta-analysis of fifteen placebo-controlled studies said that "neither soy foods nor isoflavone supplements alter measures of bioavailable testosterone concentrations in men."'
>>
I have 1 $200 ergonomic budget for work. What would you guys spend it on? Thinking headphones
>>
>>58614017
dragon dildos of course
>>
>>58614017
$200 worth of pop-tarts
>>
>>58613873
How do I access the settings of the linker?
>>
File: ergonomic-desktop.jpg (37KB, 945x400px) Image search: [Google]
ergonomic-desktop.jpg
37KB, 945x400px
>>58614017
>headphones
>ergonomic
unless you are dr dre, your work (definition of ergonomic) is unlikely to require headphones.
try the Microsoft Sculpt setup
>>
>>58614017
find a top end chair on super discount deal (like $1500 reg price on sale for $500) apply $200 voucher
you have beast chair that only cost you 20% of the reg price.
>>
File: db42ed0ae1744cb9a85ef7ffc07041cb.jpg (196KB, 1152x1536px) Image search: [Google]
db42ed0ae1744cb9a85ef7ffc07041cb.jpg
196KB, 1152x1536px
Does anyone have this:

https://www.manning.com/books/type-driven-development-with-idris

I can't find it anywhere and I've been hankering for dependent types lately.
>>
File: 0.png (72KB, 1266x713px) Image search: [Google]
0.png
72KB, 1266x713px
I decided to do a shitty ffmpeg gui after all.
Right now I'm testing 2-pass encoding + high quality mode, later I will a progress bar, sliders for trimming the file and a nice cropping mode.
>>
>>58614134
oh, canada!
>>
File: wtf.png (132KB, 1637x450px) Image search: [Google]
wtf.png
132KB, 1637x450px
>>58614041
I don't know what to do!

How do I tell the Linker what libraries to link?
>>
>>58614177
Find the directory kernel32.lib is in
Specify said directory with the -libpath option
>>
>>58614160

nice weebum for retards you got there.
>>
>>58614177
FYI we use different versions of clang, mine is from the msys2 project, I don't know where yours is from but it probably expects the native windows stuff instead of the mingw stuff like mine, so you probably need to install the Windows sdk since that's where kernel32.lib is from, then tell the linker where it is. You'll have to read about compilers and linkers, if not now, when you start using external libraries and a build system like make.

Stuff like this is why I just use msys2 instead of installing GB's of Microsoft stuff just to compile hello world. That being said I have to install it anyway for third party project but still I like to avoid it when I can.
>>
How would you describe different skill levels of programmers? Like beginner, intermediate, advanced, for example. And how do you get to the next stage from the one you're in now?
>>
File: 779539873881.jpg (35KB, 326x307px) Image search: [Google]
779539873881.jpg
35KB, 326x307px
>>58614479
Sue me.
Also, isn't that 'project' dead anyway?
>>
>>58614514

>That being said I have to install it anyway for third party project but still I like to avoid it when I can.
The only case I have found where I legitimately have to use Visual Studio is Windows drivers. MinGW/MSYS2 ld has no problem linking directly against kernel32.dll without a .lib file.
>>
>>58614533

I think you're advanced when people come to you to ask questions
>>
File: Untitled.png (29KB, 855x336px) Image search: [Google]
Untitled.png
29KB, 855x336px
>>58614514

-libpath doesn't work

I have all of these.
I tried adding a directory to the PATH on the environmental variables but that didn't work.
>>
Is there a way for CMake to automatically use every source file under a directory WITHOUT having to regenerate the makefile when creating a file, trashing the whole build, or should I just trash the whole thing and swear to never use anything else but plain Makefiles, and shit on CMake online on every occasion I get for the rest of my life?
>>
>>58614593
says you're building with 64-bit clang. are you including the $(WindowsSdkDir)\lib\x64 dir or the $(WindowsSdkDir)\lib dir? (later is 32 bit, former is 64)
>>
Doing a GPU course and I need to transfer files over ssh.

If I'm logged in to ssh to a remote server, how do I use rsync to copy files to my local desktop?
>>
>>58614641

CMake doesn't really make generic makefiles. That said, if you generate a new makefile, I don't think it's going to trash all of your existing object files...
>>
>>58614644
I included the x64 version

Why the fuck is C++ the only language that you can't just include in your environment variables and it works.
This is so stupid
>>
>>58614720
This is more of a Windows problem, Linux or Mac wouldn't be giving you this issue
>>
>>58614716
>I don't think it's going to trash all of your existing object files...

You're right.

Still a pain. It's not even "generic", it's just basic necessity.
>>
>>58614720
did you run vcvars64 before trying to use clang? it configures your environmental variables? (and will open up a COMSPEC window thats configured)
>>
>>58614017
mechanical keyboard
>>
#include <winsock.h>


I'm in.
>>
>stack smashing detected
why, and what does it mean?
int largest_value_finder(void){
64
65 puts("Performing largest_value_finder.");
66 puts("This programme will find the two largest values out of 10 inputs.");
67
68 int values[10];
69 int i=0;
70 while(i<10){
71 i++;
72 printf("\n%s%d: ", "Enter your value no #", i);
73 int value;
74 scanf("%d", &value);
75 values[i] = value;
76 }
77
78 int largest_val=0;
79 int j=0;
80 while(j<9){
81 j++;
82 if (largest_val<values[j]){
83 largest_val = largest_val*0 + values[j];
84 }
85 }
86
87 int second_largest_val=0;
88 int k=0;
89 while(k<9){
90 k++;
91 if(second_largest_val<values[k] && values[k]<largest_val){
92 second_largest_val=second_largest_val*0 + values[k];
93 }
94
95 }
96
97 printf("%s%d\n","Largest value is: ", largest_val);
98 printf("%s%d\n","Second Largst value is: ", second_largest_val);
99 return 0;
100 }
>>
File: 1466079823314.png (299KB, 1920x1080px) Image search: [Google]
1466079823314.png
299KB, 1920x1080px
>>58615103
Forgot to add picture
>>
>>58614565
The issue I always have is other people's projects, Windows devs like to distribute solution files and often rely on VC options specified in visual studio. I'm sure they could all be converted somehow but it's easier just to install it and build the way they want than convert their whole project for them.

>>58614791
I forgot all about this nonsense.
>>
Don't know if this is the right thread, but I need some help. I want to study Python. I have learned some of it like 4 years ago, but I barely remember anything. I also have some beginner-level experience with C++. I would like a good book to start off with. Thank you for any help!
>>
>>58615103
out of bounds array access
>>
>>58615103
>>58615112
>while(i<10)

...please use for loops. Just no.
>>
>>58615103
>
 70         while(i<10){
71 i++;
72 printf("\n%s%d: ", "Enter your value no #", i);
73 int value;
74 scanf("%d", &value);
75 values[i] = value;
76 }


> i is 9
> while(i<10) is true
> i gets incremented
> values[i] does not exist
>>
>>58615159
>>58615176
Thanks
>>
>>58615119

You see, I get the opposite case, because open source devs don't touch Visual Studio, unless it's a really big project, in which case, they may support both Visual Studio and MinGW. Otherwise, they just assume you're going to be on a Unix system, and Windows users can figure shit out themselves. If the project isn't heavily dependent on Unix system calls, or at least has some forethought put in to get it running on Windows, it will compile with MinGW alright. Otherwise, you may have to tweak shit around.
>>
daily reminder that a single brain concussion could ruin your programming career
>>
>>58615274
There is only two acceptable options for multiplatform c/c++ libraries, one is a cmake file which can generate a vs solution file, the other is a unitybuild.

All others can go fuck themselves with a cactus.
>>
>>58614017
Spend 200$ on lobbying for a larger economic budget.
>>
>>58615415
>economic
Ergonomic.
>>
>>58615397

>one is a cmake file which can generate a vs solution file
Typically, with a CMake file, I try to force the system to only use MinGW/GCC when on Windows. Visual Studio users can fuck themselves with a cactus.
>>
>>58615349
One of my coworkers had an aneurism and couldn't walk at all for 6 months and he still kept his job and got medical rehabilitation paid by the company because he's not a fucking code monkey like some loser who'd fear monger on /dpt/.

Just be good at your job and you're fine.
>>
Wait, is programming on python a bad thing? i just signed up on a edx course on that. I just want to get git gud
>>
>>58615470
It's not.
But you need to learn git more. gud is not a command and I don't even know what you would want from it.
>>
>>58615349

Nah, you could probably still do webdev.
>>
>>58615470
see >>58613641
>>
File: rb.gif (1MB, 320x240px) Image search: [Google]
rb.gif
1MB, 320x240px
>>58615543
>>
File: 1483042407061.gif (4MB, 422x418px) Image search: [Google]
1483042407061.gif
4MB, 422x418px
>>58615543
savage
>>
how many *printfs are there in the standard library?
>>
>>58615651
What language, you retarded piece of shit?
>>
>>58615651
8 or so.
>>
>>58615659
C

>>58615661
there's 8 listed in "man printf" but there are also *printfs for wchar_t and there's dprintf
>>
>>58615694
Which C, which library? Are you really this fucking handicapped?
>>
>>58615757
Having a rough day, friend?
>>
>>58615765
I'm not your friend, "mate".
>>
Anyone here program in LXC containers? I never get a response when I ask this but it's OK
>>
>>58615837
No, although I've thought about it. Are you asking because you do or because you're curious about it? If its the former, how is it working out?

(also here is your response)
>>
>>58615837
At work years ago we had our own Solaris Zones to use, at home I do most of my work in a FreeBSD jail as well as deploy services/servers that utilize them, both of these are basically LXC containers. It's very nice to literally have an entire OS configured exactly how you need it, if you need it.
>>
>>58615940
>>58616111

Well I keep planning to set it up on my system but I had other problems to deal with like fucked up drivers so kept getting sidetracked, but sorted those out late last night so I'm probably gonna set it up later with a small Debian container (running within an Ubungo desktop) and see how it goes. Was more curious to find out if anyone had any major hatred towards it because it sucked but as long it just werks then that's fine.
Thanks for the (You) , finally got it
>>
Can the resident Haskell expert give me a cool example of when to use Applicative?
>>
>>58615543
Don't hate on webdev fagsenpai, tonnes of people make their living from it, and do pretty well, even pajeets.
>>
>>58616146
>Thanks for the (You) , finally got it
Rarely do I regret being nice to people.
>>
>>58616166

Oh I'm not hating on it, I'm just noting that it could probably be done by a programmer who had suffered from a concussion.
>>
How do you code some low level stuff in C like drivers for example?
>>
>>58616284
https://a.uguu.se/MbVLNgdMsiJH_FreeBSDDeviceDrivers.pdf
>>
>>58616284
You just asked a vague as hell question with no good answer.

The tl;dr is basically the same as user code, but allocating memory is a bit different and you'll be calling what ever kernel functions directly instead of using the syscall interface. Which kernel functions you'll be using depends on what you're doing.
>>
File: 1484932983679.gif (912KB, 240x176px) Image search: [Google]
1484932983679.gif
912KB, 240x176px
>https://www.youtube.com/watch?v=hhR3DwzV2eA
>this fuck-up has a job
>you're unemployed
>>
>>58616353
People skills over programming skills.
>>
>>58616320
That looks interesting.
>>
>>58616370
I'm a people person, God dammit. Why can't you idiots see that. Fuck.
>>
>>58611975
What features does it have? I'm writing a thing like this myself atm

Also what langague did you write it in? GUI looks comfy but meh if it's htmlcssjavascript with a browser engine underneath
>>
>>58611896

How hard is it to design a very simple text editor? Nothing fancy, just something that can take any number of lines, save and load text files from a drive
>>
If i have a HQ office and SQL database for it, how do i make databases for other 5 branch offices that contain the exact same products as main HQ database, when they "order" products that number is deducted from products in main HQ database and yet, all branch databases should be local
>>
>>58616166
>they make money out of it therefore it's useful
Programming can't be saved anymore. Reversing back to an acceptable state gets harder with time and it's just too late.
>>
Bash

I want to extract part of a string in bash, but only if it's contained within another substring.

I want to remove the / in "Name/ of/ file.ext" but only if the / is followed by a space
>>
>>58616537
>extract part of string if it's contained within another string
regex capture groups

>remove x if it's followed by y
replace "xy" with "y" should be enough
>>
>>58616490
>Web programming isn't useful
You're using it right now, dipshit
>>
>>58616458
Replication you fucking moron, didn't you bother to check this much , yet someone has somehow trusted you with such a job? This is how I knew I was getting underpaid in my last job and left for a fuckton more. /g/ should take a lesson here.
>>
>>58616723
>4chan is useful
>>
>>58616723
I'm using clover :^)
>>
>>58616740
i don't even work, this is my hobby project i thought of while listening to my friend working in a similar company
>>
I have no programming skills at all, but i want to create python tool that can parse txt file with 1000 youtube channels and give me output about how many subs they have right now. It's going to work like this i suppose: https://gist.github.com/eighthave/7285154
Where to start?
>>
>>58616819
Reading a book on Python.
>>
>>58616819
what the txt file looks like?
>>
>>58616943
Probably just a list of URLs.
>>
>>58616781
Exactly you fucktard
>>
>>58616763
If you're not making use of it and learning, it's only your own dumb fault
>>
>>58616953
you don't need to do it in python, c# with htmlagilitypack is perfect for this, but you'll need to play with some Xpath to find exact place of subs on site
>>
>>58611896
Hobbyist here, not planning on getting a job in programming but probably will get a job in tech (sys admin or fixing pcs or something) should I bother making a github to host my projects?
>>
>>58617010
>implying I can learn from the people that come here
>>
>>58617044
What project if you don't do programming?
>>
>>58617044
Unless you want offsite storage, you can just set up local repos on another computer.
>>
>>58617076
automation projects, for example bruteforcing hashes and stuff
>>58617080
offsite would be a good bonus
>>
>>58616537
echo "Name/ of/ file.ext" | sed "s|/ | |g"
>>
how do I write some simple cpu emulator in haskell? I need to store many variables, how to do it functional way?
>>
>>58617017
Pretty sure this would be pretty easy in C# or Python.

That being said, I'm tempted to knock this out in a few minutes exactly as you've described it in C# because it would be piss easy.

>>58616819
Post list of channels.
>>
Is Monespaced a meme font?
>>
>>58617318
create a new immutable universe each time something changes
>>
>>58617353

*Monospaced
>>
Just want to let you all know

I FUCKING HATE JAVA REEEEEEEEEEEEE
>>
>>58611896

https://github.com/jmm140330/Rubik

I finished this Rubik's cube solver in C++. I'd appreciate any tips on what I can do better, I'm still very new to programming.
>>
>>58617318
Refer to this: https://en.wikibooks.org/wiki/Haskell/Mutable_objects
>>
how do I master OOP
>>
>>58617385
Be aware of this
https://www.youtube.com/watch?v=LYs_GCy9PRk
>>
>>58617448
Read The Art of the Metaobject Protocol
>>
>>58617055
If you're retarded as you clearly are, then you would have trouble learning even from a professional tutor. If you're not, what the anons here can show you is more than enough. At least it has been for me.
>>
>>58617384
t. neo-/dpt/
>>
>>58617632
>t. neo-/dpt/
t. neo-/dpt/
>>
>>58617625
I don't learn here for the same reason I don't fetch my water from the desert. But thanks for your personal pile of sand. It sure changed my mind.
>>
>>58617536
Are you freaking serious?
>>
I've failed college exams because I got a very stressful full-time managerial job that I'm leaving in a month.
I have two android apps I've developed.
Will I be able to get a code monkey level job to be able to afford food and a room with some experience but no diploma?
>>
>>58617734
REKT
>>
>>58617815(You)
>>58617734(You)

>Rekt'ing your own comment
>>
>>58617777
I was having the same issue a couple of years ago. Working 60+ hours a week as a fast food manager, and nearly impossible to attend fulltime class (while being awake).

I quit the job as soon as I had enough cushion for 3 months rent/expenses, took a chance on the first IT company to give me an interview for a jr. sysadmin/automation role, and they even let me have every Monday off to drive 2 hours to the university and finish my last classes.

Doing quite well these days, making well over the US median income, plenty of days off, traveling often (work and pleasure).

All I can say is that sometimes you have to take a chance, and get the fuck out of your dead-end role and push into the field you want to be in. I got lucky, no doubt about that, but you've got to make the effort.

If you've actually got two apps developed that you can show off, that's a very very good thing for interviews.
>>
File: ss.png (10KB, 382x125px) Image search: [Google]
ss.png
10KB, 382x125px
>>58617830(You)
Keep shoveling more on, anon.
>>
>>58617734
That's just silly. Sure, there's lot of shitposting, but I've seen plenty of great advice here, and anons helping out with code samples and resources.
>>
>>58612066
I don't want anyone to contribute to my projects until I'm finished with them.
>>
>>58617852
>knowing how to use Inspect element
>>
>>58612512
>>58612514
Modules are at least 5 years away still, probably way more.
>>
>>58612669
Go ahead. It won't do shit in userspace.
>>
>>58617891
>thinking I care enough to even bother

Here's another (You) that you crave so dearly.
>>
>>58617777
Places like plebbit will tell you that you need to have a plethora of projects and know long lists of buzzwords, but if you're a functioning human being and you can demonstrate that you're not just another fag looking for easy cash, someone's going to hire you.

As long as you aren't like the "manager" I have who just tried to cover up that he didn't finish a database he was supposed to have set up back in late November until the 13th by blaming his coworkers, you should be ok.
>>
>>58617255
thanks la
ended up doing
INPUT=${1//\\\ /\ }
though
>>
>>58616819
>>58616819
>>58616819

Do you still want the program, i made it already? I didn't bother with Threading so it freezes while it's searching for subs on YT but it works, writes all names and subs on txt file on Desktop
>>
Lua patterns 2: Electric boogaloo

'[w%     \n<>=:,;]+%p?'
>>
>>58618034
It'll probably not work how I want it though
>>
>>58618048
>>58618034
Much better:
'%w+%s?=%s?[%w%s<>,\'\"]+%;?'
>>
New thread:

>>58618092
>>58618092
>>58618092
>>
>>58613372
Visual x86 decompiler? Sounds kinda cool. You like it?
Thread posts: 313
Thread images: 39


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

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


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