[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: 341
Thread images: 34

What are you working on, /g/?

Old thread: >>59672986
>>
First for Python!
>>
>>59677821
Explain the desu girl pls
Asking for a friend
>>
File: 1486667937313.jpg (9KB, 256x191px) Image search: [Google]
1486667937313.jpg
9KB, 256x191px
I made this:

http://www.drawy.io/

A collab drawing app. Just pushed it onto AWS today, very much an embryonic release. Feel free to try and break it.
>>
nth for show me your TE
>>
File: VN.png (282KB, 490x639px) Image search: [Google]
VN.png
282KB, 490x639px
oops post my bait in the dead thread

studying math
>every CS student barely grasps highschool topics
>they even pull the "lol I hate math" shit
How can this be? It's so ugly and bizarre to me.
>>
>>59677902
moot please stop
>>
>>59677938
I bet canvas could have worked if he made it NSFW instead of trying to pander to normies
>>
File: ebic.png (2KB, 62x404px) Image search: [Google]
ebic.png
2KB, 62x404px
>>59677902
>>
>>59677902
almost as good as https://www.reddit.com/place?webview=true
>>
>>59678021
what is your browser and os?
>>
>>59677821
learning ruby
[70] pry(main)> a
=> [1, 2, 3, 1, 2, 3]
[71] pry(main)> a | a
=> [1, 2, 3]
[72] pry(main)>

That's pretty neat
>>
>>59678080
My guess is you used retarded font embedded icons.
>Anyone loading remote fonts ever on any OS or browser
>>
>C++
https://www.youtube.com/watch?v=MZIv6WtSF9I

>python
https://www.youtube.com/watch?v=qFl-Q21MzmQ
>>
File: kys.jpg (37KB, 600x600px) Image search: [Google]
kys.jpg
37KB, 600x600px
>GNU-males STILL wasting their time with Vim instead of using a good IDE
>>
How do I make myself enjoy programming again
>>
Programming concepts homework.
>Create a loop that will out
put all the numbers less than 200 that are evenly
divisible by both 2 and 7.

The code I came up with does output the proper numbers and all so I'll get full credit either way but is this the most "efficient" way of doing this? So far all we just go to loops in C. Also no bully if this doesn't work, I've never used the code tag on /g/ before

{
int div = 0;
while (div < 200) {
div++;
if (div % 2 == 0 && div % 7 == 0)
printf("%i\n", div);
}
system("pause");
}
>>
>>59678160
use python.
>>
>>59678162
It's good.
>>
I'm still not convinced why I should Rust over C. The only nice things I'm seeing are honestly the closure support (can be implemented in several fashions in C) and channel support (trivial to implement in C if needed though). The GC looks nice, but anyone that watches their heap usage and tests their code thoroughly and in a modular fashion can keep it bug free with good old malloc/free.
>>
>>59678151
emacs is the best IDE
>>
>>59678160
Just do it. Start somewhere, it doesn't have to be a big project.
>>
>>59678208
Rust does a lot of nice things but "anyone who does X can do it in C" only works for so long before someone fucks it up. That's the real reason it exists, for those fuckups. Also concurrency is a breeze in the borrowing model, the rest of the everything is less easy because of it. Lifetimes are also kind of a pain to get used to.

It's a great language in its own right just too immature without diving deep into nightly.
>>
File: 1449700279793.png (74KB, 300x256px) Image search: [Google]
1449700279793.png
74KB, 300x256px
>>59678208
>The GC
>>
>>59678160
i have this problem too

i used to program all day long, now im too lazy
>>
>>59678162
your teacher would suggest the 'for' loop instead of the while loop for this
>>
>>59678274
>Also concurrency is a breeze in the borrowing model, the rest of the everything is less easy because of it.
Principled borrowing is important for more than just concurrency. It allows the compiler to optimize aggressively while preventing any kind of hazard. Like I said in the last thread, Rust is harder and faster than C without optimizations like restrict but it's far easier and only slightly slower than C with them.
>>
>>59678162
{
for (int i; i < 200; i++) {
if (i % 2 == 0 && i % 7 == 0)
printf("%i\n", i);
}
system("pause");
}
>>
>>59678365
>int i;
int i = 1;
>>
>>59678151

Yeah, I'm just going to continue using Sublime. IDEs have uncomfortable, clunky interfaces, and Vim requires a bit of configuration.

>>59678162

Remove the system("pause"); part.

Also, consider using a for loop, instead of emulating a for loop with a while loop.
>>
>>59678424
>I'm just going to continue using proprietary shitware because I can't be bothered to configure vim to fit my workflow
How is this justified?
>>
File: rami.jpg (64KB, 959x639px) Image search: [Google]
rami.jpg
64KB, 959x639px
>work in call centre
>my associates only copy paste the codes from google sarches
>no desire 2 multi-paradigm
>no interest in vedic maths
disapointed, my desis
>>
>>59678424
>Remove the system("pause"); part.
his teacher might require it
>>
File: hackerrank.png (21KB, 472x476px) Image search: [Google]
hackerrank.png
21KB, 472x476px
>>59677821
>What are you working on, /g/?
doing all the C++ "challenges" on hackerrank because I have nothing better to do with my time
>>
>>59677900
It's a fractally-ironic meme created by an asexual namefig from [s4s].
>>
>>59678476
I don't need a justification.

>>59678493
Gonna be honest, I'd fail a student if their code contained that garbage. The program MUST terminate, or it fucks with the grading script.
>>
>>59678534
>hackerrank
what kind of 'challenges' are these? Simple stuff/Math Stuff/Actual exploit stuff/Reverse engineering?
>>
>>59678555
they usually add system pause because cmd close when they run code and they cant see results.

We needed to use it just because of that
>>
>>59678279
>implying refcounting isn't GC
>>
>>59678320
>>59678424
Yeah she probably would prefer the for loop instead so I did the next question with that instead.
>Create a loop that will calculate the sum of the multiples of 8 that are between 100 and 500. Output the sum only.

{
int sum = 0, i;
for (i = 100; i < 500; i++)
{
if (i % 8 == 0)
sum += i;
}
printf("%i\n", sum);
system("pause");
}


And I don't mean to use this thread as my homework checker so I'll stop at that.

>>59678555
My professor requires the system("pause"); and she hand grades everything.
>>
>>59678596
Regardless of whether reference counting is GC or not you're not supposed to use reference counting much. You're supposed to use single ownership and borrowing as much as possible since it's the most efficient and easy to reason about.
>>
>>59678589

Program is being run incorrectly. Either do "run without debugging" if you MUST use an IDE, or run it from a shell (the correct way to run a command line program).

You need to stop using system("pause") or cin.get() or any of that garbage that stops your program from terminating.
>>
>>59678589
You really shouldn't be running your programs from the file manager in the first place though. Either use the command line, or an IDE with a console pauser built in as part of the run command. And even if you need it, system("pause") is a poor choice, since it's not portable. Better to do something like
puts("Press ENTER to close.");
getchar();
>>
>>59678622

Your professor is a moron and should be stripped of her PhD.
>>
>>59678654
>Better to do something like
It's better to do nothing at all.
>>
File: tracks.png (90KB, 1339x741px) Image search: [Google]
tracks.png
90KB, 1339x741px
>>59678579
mostly algorithm challenges which can be solved in basically any language
there's no reversing or exploit challenges like hackthissite has

the language specific ones are basic introduction type problems for that language
>>
>>59678654
>>59678636
this was in Visual Studio, 3 years ago
When you run program it just run it and close it (if it is working)
So we add pause or while(1) just to see results and then remove it.
That happens on some computers but on some cmd didnt close so they didnt need to add pause or while
>>
>>59678670
I mean if you really need to run a character-mode program from the file manager, for whatever reason.
>>
>>59678692
Weird, I would think Visual Studio 2008 would run the program within a console pauser (which can be implemented as simple as a batch script that's like
@echo off
%PROGRAMNAME%
pause

) and even Dev-C++ has that feature.
>>
>>59678724
as i said, on some computers it worked nice bot on some it didnt so we needed to add that

there was one more command i thing getch() or something like that
>>
system("pause") should never be used because it opens up an arbitrary execution vulnerability in your program. Slip a program named pause.exe into the same directory as the vulnerable program, and that program gets run in place of the ordinary pause command.

Friends don't let friends use system("pause");
>>
File: professional bitcoin trader.jpg (72KB, 497x501px) Image search: [Google]
professional bitcoin trader.jpg
72KB, 497x501px
How difficult would it be to program a bitcoin trading bot?

I imagine it would be simple, since I'm just automating buying and selling based off real-time data, but the most complex program I've ever made was a text-based calculator in Pascal.

Also, which language would be best for something like this?
>>
>>59678804
>How difficult would it be to program a bitcoin trading bot?
very easy
but if bitcoin trading is anything like real forex trading, you can't make money doing it
>>
I wrote a ray tracer in z80, anyone wanna see it?
>>
>>59678839
Yeah
>>
primes in ruby
[41] pry(main)> def prime p
[41] pry(main)* return false if p < 2 or p % 1 != 0
[41] pry(main)*
[41] pry(main)* 2.upto p - 1 do |x|
[41] pry(main)* return false if p % x == 0
[41] pry(main)* end
[41] pry(main)*
[41] pry(main)* true
[41] pry(main)* end


get the primes in the range of 1 to 20

[45] pry(main)> (1..20).to_a.select {|x| prime x}
=> [2, 3, 5, 7, 11, 13, 17, 19]
[46] pry(main)>
>>
>>59678151
>not using nano
>>
Is there any benefit in implementing your own data structures in C or should I just pick up a library and hope it's good?

Are there any good libraries for dynamically sized in-place kind of stuff (ie: lists, queues, etc)
>>
>>59678876
>return false if p % x == 0
Why the fuck is there stupid special snowflake syntax like this?
These languages (Ruby, Python, etc.) are trying to be too "cute" by trying to read off like an English sentence.
>>
>>59679063
just use c++
>>
>>59679089
That is honestly the worst advice you could give to anyone under any circumstance.
>>
>>59679089
>C++
No thanks.
>>
>>59679089
kek
>>
>>59678770
That's actually not the case on modern versions of Windows, since pause is a shell builtin, and as such has higher search precedence than even a file in the current directory.

Additionally, it's worth noting that the Unix command line is specifically designed to prevent this sort of attack, by only searching the current directory if you explicitly tell it to look there.
>>
>>59679089
this is a reasonable post.
>>
just spent an hour digging around the attic to find a serial cable so can into remote debugging like a real /g/entoomen.
finally found one, turns out there's a difference between male and female cables
>>
File: 1489242690157.jpg (87KB, 334x443px) Image search: [Google]
1489242690157.jpg
87KB, 334x443px
>>59679089
>>
>>59679063
>dynamically sized in-place
>lists
I think you are confused about some of the basics of data structures
>>
I started working with rest api in java this past weekend, does anybody know how I could get access to the 4chan api so I can browse /g/ from the command line using api requests
>>
>>59679251
add .json to the url
>>59677821.json
>>
>>59679251
https://github.com/4chan/4chan-API
>>
>>59677821
>What are you working on, /g/?
delimiter $$
create procedure register_user(in pname varchar(64), in pemail varchar(64), in ppass varchar(64),
out response varchar(128), out userid bigint unsigned) begin
declare user_exists boolean;
declare salt varchar(64);
select count(*) into user_exists from user where email = pemail;
if char_length(ppass) < 3 then set response = 'password too short';
elseif user_exists = 1 then set response = 'email already registered';
else set response = 'ok';
set salt = substring(sha2(rand(), 512) from 1 for 64);
insert into user (name, email, pass_salt, pass_hash, signup_verification_code)
values (pname, pemail, salt, sha2(concat(ppass, salt)),
substring(sha2(rand(), 512) from 1 for 6));
select max(id) into userid from user;
end if;
select response, userid;
end $$
create procedure verify_user(in userid bigint unsigned, in pvcode char(8),
out response varchar(128)) begin
declare user_exists boolean;
declare user_verified boolean;
declare vcode char(8);
select count(*), signup_verification_code, verified
into user_exists, vcode, user_verified from user where id = userid;
if user_exists = 0 then set response = 'user does not exist';
elseif user_verified = 1 then set response = 'user already verified';
elseif vcode <> pvcode then set response = 'wrong verification code';
else set response = 'ok';
update users set verified = 1 where id = userid;
end if;
select response;
end $$

i don't actually know how mysql works, please be gentle
>>
>>59679085
it's not that they're trying to be "too" cute in reading like English, it's that they're designed to be read like English. Different languages have different goals and problem domains and use cases. How is this hard for you?
>>
>>59678162
it would be better to just do (!(div % 14)) since anything cleanly divided by both 2 and 7 is divisible cleanly by 14
>>
>>59678160
use Rust
>>
Want to do SICP and practice emacs. What's the best Lisp/Scheme to use? MIT/GNU Scheme? Guile? Don't say Racket.
>>
>>59679422
How does Rust make me enjoy programming again?
>>
>>59679377
There is no point, and it usually just hides the important information behind a lot of stupid fluff.
Consider the python "ternary statement"
if_true if cond else if_false

The fucking important part, the condition, is hidden in the middle of that sentence and would be much easier to accidentally miss when reading over code.
>>
>>59679085
If you think that's bad, just wait until I finish my compiled language designed to be written on cellphones using speech recognition. I call it "English."

Let there be a kind of thing called a point and let it be defined thus:
Let a point have integers called x and y.
Thus concludes the definition of the kind of thing called a point.
Let there be points called p and q.
Let the x of p be 0.
Let the y of p be 1.
Let the x of q be 1.
Let the y of q be 0.
Let there be an integer function called distance, in points called a and b, and let it be defined thus:
Let there be an integer called x distance, and let it be defined as the x of a minus the x of b.
Let there be an integer called y distance, and let it be defined as the y of a minus the y of b.
Let this function simplify to the square root of the sum of the square of x distance and the square of y distance.
Thus concludes the definition of the integer function called distance.
Report the distance of p and q.
>>
>>59679521
do you really speak like that
>>
>>59679546
No. Of course I don't.
That's the best part.
>>
>>59679521
>speech recognition programming
wew lad, it is interesting tho
>>
>>59679521
Looks like COBOL.
>>
>>59679573
>>59679595
I was actually kidding, I'm not working on this.

Though, having said that, it might not be a bad idea if it could be done better than this. If it's friendly enough, a programming language that can be read aloud without loss of information -- and can therefore be written via speech recognition -- could revolutionize the nature of programming as a discipline. Imagine, people could be programmers and still actually go outside.
>>
>>59679663
>I was actually kidding, I'm not working on this.
You can't imagine how I'm mad when actually good ideas, released on April 1, happen to be jokes.
>>
>>59677926
Are you from a country like germany, where anybody can start studying cs without any entrance test? If so, probably morons who did not know what to do yet and "liked computers" a.k.a. Photoshop Philipp or /v/. Bet they become fewer in the higher semesters
>>
Rust's error handling is confusing.
>>
>>59679732
How so?
>>
>>59679663
>what is the human memory
The only thing that will revolutionize programming is convenient AR.

Like your phone being the host and turning a surface or two into a projected screen and (magically) have a projected keyboard with feedback and the feel of switches. Or people will just get implants to pair.
>>
>>59679713
oh my god it's april 1 I didn't even realize
don't worry though, I'll probably still do this at some point now that I've got my mind set on it, it'll just be a lot less needlessly verbose than what I've got here

>>59679743
that would also be cool
>>
>>59679742
Why couldn't it just use the simple try-catch model
>>
>>59679783
Its still the 31st in relevant land
>>
>>59679663
>Imagine, people could be programmers and still actually go outside.
I can't imagine how you would program on the go, to be honest.
>>
File: Lenovo_G500s_laptop-2905.jpg (4MB, 3861x2896px) Image search: [Google]
Lenovo_G500s_laptop-2905.jpg
4MB, 3861x2896px
>>59679817
>>
>>59679794
Because try/catch isn't very simple. It can be a control flow nightmare, which is important to avoid when you have RAII and not garbage collection. Not that Rust doesn't have your standard exceptions, they're just called panics and you're generally not supposed to catch them because then you don't have strange control flow.
>>
>>59678089
What's it doing here? Converting it to a set and doing a set union with itself?
>>
>>59679334
haha holy shit i tried doing all the logic for a game in stored procedures once, never again, dude never again
>>
>>59679879
C++ has try-catch
>>
File: 1483899740618.png (276KB, 600x558px) Image search: [Google]
1483899740618.png
276KB, 600x558px
>>59679877
>laptop keyboard
>>
what's g++ -c doing?
>>
>>59679380
You overestimated my basic math skills.
>>
>>59679944
It outputs an object file instead of a fully linked executable.
>>
1,4,7 - Learn Rust
2,5,8 - Keep using C and do stuff from scratch
3,6,9 - Keep using C + try to use external libraries and focus on the problem at hand
0 - reference the digit before this one for decision
>>
>>59679794
>>59679879
Also, exceptions are a bad choice for when you expect errors to happen under normal circumstances (e.g. the user asks for a file that doesn't exist). They make the exceptional case extremely expensive in return for making the success case completely free, whereas doing it with return codes or algebraic data types makes both cases have a very small amount of overhead (though branch prediction can be used to lean towards one or the other as being more cheap).

>>59679915
C++ shouldn't be used as an example of what to do when designing a language, ever. It also doesn't have nearly as advanced RAII as Rust's. Rust has affine types and borrowing to worry about.
>>
take a spaghetti break anon
you've done enough computer today
well done, my son
>>
>>59680018
dad?
>>
>>59679982
>Rust has affine types
dam gurl dat a fiiiiiiine type
>>
>>59679944
compile but don't link
>>
>>59679448
Common Lisp
>>
File: grinman.jpg (12KB, 381x371px) Image search: [Google]
grinman.jpg
12KB, 381x371px
Will C, C++, Assembly and Lua be the only languages I will ever need
>>
>>59680117
You can already do everything in C so yeah
>>
>>59677821
What's the difference between a point and the zero vector?
>>
>>59680117
Strike C++ from that list and you'll be correct.
>>
>>59680117
scratch c and lua and you're all set
>>
>>59680138
>>59680140
so just assembly then
cool
>>
The most useful feature in C is macros.
Technically, it's a literal text substitution and not even part of the language itself.
That should tell you something about C.
>>
>>59680117
What's the cockmongler doing now, I wonder
>>
Is there any performance loss in using:
struct node {
struct node *next;
void *elem;
};


versus a more specific:
struct inode {
struct node *next;
int *elem;
};

struct cnode {
struct node *next;
char *elem;
};

//etc
>>
redpill me on inline namespaces.
>>
File: man.png (152KB, 381x371px) Image search: [Google]
man.png
152KB, 381x371px
>>59680117
>>
>>59680198
I'm more of a fan of
struct node {
struct node *next;
unsigned char data[];
}

Less allocations and less indirection, but you have to make sure your helper functions deal with this properly.
>>
>>59680223
where the fuck else are you going to put them.
>>
File: Happynegro.jpg (31KB, 261x502px) Image search: [Google]
Happynegro.jpg
31KB, 261x502px
>>59680228
Is this the man formally known as Richard "KR" C Mongler? I heard about his brother Cockmongler.
>>
>>59680198
use templates scrub

template <typename T>
struct node {
node *next;
T data;
}
}
>>
>>59680117
yes, if you don't need a job
>>
File: 1450770707376.png (289KB, 514x424px) Image search: [Google]
1450770707376.png
289KB, 514x424px
>>59680253
>Object code bloat
>>
>>59680253
oops too many squigglies
>>
File: 1429054903847.png (78KB, 249x250px) Image search: [Google]
1429054903847.png
78KB, 249x250px
>>59680253
>C++
>>
>>59680198
template<typename T>
struct node
{
node* next;
T* element;
};
>>
>>59680269
>object
that's not object-oriented ur dumb
>>
>>59680253
>>59680279
shit I'm slow
>>
File: ziggy.gif (969KB, 606x304px) Image search: [Google]
ziggy.gif
969KB, 606x304px
>>59680253
>suggesting someone add c++ code to a snippet that compiles just fine in vanilla c
>>
what is the best assembly compiler?
>>
>>59680291
Object code has literally nothing to do with POO.
>>
File: explodingknees.jpg (53KB, 700x700px) Image search: [Google]
explodingknees.jpg
53KB, 700x700px
>these vintage memes
https://www.youtube.com/watch?v=vqKD5q7h6Oo

post dev music
>>
File: bjarne.jpg (28KB, 222x229px) Image search: [Google]
bjarne.jpg
28KB, 222x229px
>>59680269
>>59680272
wtf i hate c++ now
>>
>>59680306
fasm
>>
>>59680306
nasm
>>
>>59680296
>suggesting someone make an alteration to code which makes it more readable because they don't care about "reeeee muh pure C"
I agree, how dare he
>>
>>59679085
What's that? You want more of my ruby wonkery? Well, I've only just started learning the language, but if you insist -
[164] pry(main)> class Array
[164] pry(main)* def my_select
[164] pry(main)* selected = []
[164] pry(main)* 0.upto self.length - 1 do |index|
[164] pry(main)* selected << self[index] if yield self[index]
[164] pry(main)* end
[164] pry(main)* selected
[164] pry(main)* end
[164] pry(main)* end
=> :my_select
[165] pry(main)> [1, 2, 3].my_select { |x| x > 1 }
=> [2, 3]
[166] pry(main)>
>>
>>59680291
>>59680272
>>59680271
>>59680269
>>59680296
>>59680328
I really don't get all the hate for C++. It's a perfectly fine language and for your C autists you can basically use it like C with classes/templates/better std library if desired.
>>
>>59679478
I don't like Python's ternary either.
Gotta be cond ? true : false
>>
>>59680343
>It's a perfectly fine language
I'm not even going to bring this into a C vs C++ thing, but C++ is a fucking awfully designed language.
If you seriously think C++ is even passable, I'm convinced that you're either an extreme beginner than ONLY knows C++, or an insane person.
Go learn a language that is actually designed competently.
>>
>>59680343
Rust is faster and generally far better designed than C++.
>>
>>59680365
Having a design makes something more/better designed than C++
>>
>>59680308
On the contrary, it does; you can use object code to implement OOP at the assembly level.
>class = object file
>fields = any kind of state defined in that file
>private methods = symbols with internal linkage
>public methods = symbols with external linkage
>instance of the class = what happens when you dynamically link the object file into a larger executable
>more than one instance = what could happen if only you could dynamically link an object file more than once -- could possibly be accomplished with load-time symbol mangling???
>>
>>59680365
bait harder
>>
>>59680362
>>59680365
>I don't understand it
>must be a bad language
>>
>>59680362
literally MILLIONs of PROFESSIONAL developers disagree.

>>59680365
Rust lacks a community and is still immature and not stable. You have to resort to relying on C libraries for most stuff still.
>>
>>59680379
I'm probably a better C++ programmer than you.
>>
>>59680391
explain value categories
no google.
>>
>>59680397
I know about rvalues and lvalues but fuck me if I can remember any of the convoluted xvalue grvalue shit.
>>
#define SGLIB_ARRAY_BINARY_SEARCH(type, a, start_index, end_index, key, comparator, found, result_index) {\
int _kk_, _cc_, _ii_, _jj_, _ff_;\
_ii_ = (start_index);\
_jj_ = (end_index);\
_ff_ = 0;\
while (_ii_ <= _jj_ && _ff_==0) {\
_kk_ = (_jj_+_ii_)/2;\
_cc_ = comparator(((a)[_kk_]), (key));\
if (_cc_ == 0) {\
(result_index) = _kk_;\
_ff_ = 1;\
} else if (_cc_ < 0) {\
_ii_ = _kk_+1;\
} else {\
_jj_ = _kk_-1;\
}\
}\
if (_ff_ == 0) {\
/* not found, but set its resulting place in the array */\
(result_index) = _jj_+1;\
}\
(found) = _ff_;\
}


>C generics
>>
>>59680379
That is a shitty non-argument that is designed to deflect all criticism. Going by that, basically nobody is qualified to say anything about C++, because I do not believe there is a person alive who truly understands all of it.
I understand _enough_ of C++ to know that it's a clusterfuck.

>>59680386
>literally MILLIONs of PROFESSIONAL developers disagree.
So? Just because something is popular, it doesn't mean that it's not fucking garbage.
>>
#include <cstddef>
#include <array>
#include <utility>

auto constexpr sum(){
return 0;
}

template<typename T, typename... Tn>
auto constexpr sum(T num, Tn... nums){
return num + sum(nums...);
}

template<size_t N, size_t bit, size_t ...bits>
struct getSum : getSum<N-1, bits...> {};

template<size_t bit, size_t ...bits>
struct getSum<0,bit,bits...> { static constexpr size_t value = sum(bits...); };

template <size_t N, size_t ... nums, template <typename,size_t...> class T>
auto constexpr get_sum(const T<size_t,nums...> bits){
return getSum<N, nums...>::value;
}


template <size_t ... indices, size_t... nums, template <typename,size_t...> class I, template <typename,size_t...> class N>
auto constexpr get_sums(const I<size_t,indices...>, const N<size_t,nums...> bits){
std::array<size_t, sizeof...(indices)> arr = {
get_sum<indices>(bits)...
};
return arr;
}

template<size_t ...bits>
auto constexpr bitOffsets(){
return get_sums(std::make_integer_sequence<size_t,sizeof...(bits)>(), std::integer_sequence<size_t,bits...>());
}

auto test(){
return bitOffsets<1,2,3,4,5>();//{14,12,9,5,0}
}

What I love about this is that it works perfectly and yet I suspect that anyone who doesn't really know their shit will not be able to read it.
>>
>>59680408
Or you could stop being a stupid faggot and just use bsearch() from <stdlib.h>.
>>
>>59680425
Variadic templates with specialization are pretty tame compared to the more esoteric parts of C++ like the value categories anon brought up.
>>
File: 1490501104162.jpg (63KB, 214x259px) Image search: [Google]
1490501104162.jpg
63KB, 214x259px
I want to learn lisp. Where do I start?
>>
>>59680447
http://www.wikihow.com/Tie-a-Noose
>>
>>59680447
Land of Lisp seems really nice.
I learned via Paul Graham's ANSI Common Lisp books tho.
>>
>>59680447
https://en.wikipedia.org/wiki/Lambda_calculus
>>
wow ruby lets you subtract arrays from arrays
wow ruby lets you pass blocks but memorizing the syntax for doing that makes my head bleed
[174] pry(main)> class Array
[174] pry(main)* def my_reject (&block)
[174] pry(main)* rejectThese = self.my_select &block
[174] pry(main)* self - rejectThese
[174] pry(main)* end
[174] pry(main)* end
=> :my_reject
[175] pry(main)> [1, 2, 3].my_reject {|x| x > 1}
=> [1]
[176] pry(main)>
>>
>>59680447
thart by thpeaking like thith
>>
>>59680425
>auto return type
what
when did this become valid c++?
>>
>>59680488
about 6 years ago
>>
File: ziggy-fast.gif (782KB, 606x304px) Image search: [Google]
ziggy-fast.gif
782KB, 606x304px
>>59680372
>object-oriented assembly
kill me
>>
>>59680440
You don't really see value categories in code though, I'm just marveling at how much of a monstrosity templates can look when you get into them

>>59680488
C++11 dude
>>
File: sicp.jpg (28KB, 455x662px) Image search: [Google]
sicp.jpg
28KB, 455x662px
>>59680447
>>
>>59680512
>SICP
dat sum sic pee breh
>>
>>59680483
don't like passing blocks like every other language? let things get magical and ambiguous with yield!

[178] pry(main)> class Array
[178] pry(main)* def my_other_reject
[178] pry(main)* rejectThese = self.my_select {|x| !(yield x)}
[178] pry(main)* rejectThese
[178] pry(main)* end
[178] pry(main)* end
=> :my_other_reject
[179] pry(main)> [1, 2, 3].my_other_reject {|x| x > 1}
=> [1]
[180] pry(main)>
>>
>>59680503
>>59680498
jesus I'm so old
I'm barely even starting to use those features
>>
>>59680578
c++98 is absolute shit compared to modern c++.
seriously, try it out.
>>
>>59680578
Shit updates every three years now too
We're on C++17 now
>>
>>59680611
I'm fairly reluctant because the more of it you use, the less it resembles the C++ that I know
>>
>>59680425
I think you can reduce the sum function to just (nums + ...) in C++17. or even omit it altogether.
>>
>>59680629
that's a good thing.
once you know c++14/17, you'll wish you never knew c++98 in the first place.
>>
>>59680636
I can, but I'm sticking with 14 until MSVC gets its shit together
>>
>>59680629
then get to know new c++
>>
any interesting stuff from c++17 for beginners?
>>
>>59680650
know of any crash courses for working professionals who wish to move from classical C++ to modern C++?
>>
>>59680662
http://stackoverflow.com/questions/38060436/what-are-the-new-features-in-c17
>>
>>59680611
c++ is absolute shit
>>
>>59677902
fuck you
yeah you heard me
fuck you

baboosh@cuntsniper: nmap drawy.io

Starting Nmap 7.12 ( https://nmap.org ) at 2017-03-31 18:14 PDT
Nmap scan report for drawy.io (192.64.119.154)
Host is up (0.047s latency).
Not shown: 988 filtered ports
PORT STATE SERVICE
21/tcp closed ftp
22/tcp closed ssh
25/tcp closed smtp
53/tcp closed domain
80/tcp open http
110/tcp closed pop3
143/tcp closed imap
443/tcp closed https
587/tcp closed submission
993/tcp closed imaps
995/tcp closed pop3s
8080/tcp closed http-proxy

Nmap done: 1 IP address (1 host up) scanned in 12.00 seconds
>>
>>59680689
I said for beginners, you silly. I don't understand that shit
>>
>>59680257
you can find a job with that

but java is a safer choice
>>
>>59679976
roll
>>
>>59680668
Just keep asking yourself "is there an easier/better way to do this thing I just wrote?", then look up new features on cppreference.com.
That's how I did it.
>>
>>59680705
how about this shit?
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r1.html
>>
>>59679976
rolls royce
>>
>>59680704
dont hack me pls
>>
File: 1488333770140.jpg (24KB, 324x278px) Image search: [Google]
1488333770140.jpg
24KB, 324x278px
>>59680704
I am le master haxor I use nmap xDDDD
>>
>>59680723
God damn, that is a retarded """feature""".
>>
>>59680717
Oh boy I'm fucked. Last time I tried rust I couldn't do implicit conversions.

so
let x: i32 = 15;
let y = x*9/5 + 32;

does not compile in Rust.
>>
seeing if Ethereum is worth doing
>>
>>59680749
don't use rust
>>
>>59680704
>>59680730
>>59680740
why is it offline
drawy.io
>>
my 2 digit iq brain is too stupid to figure out how to not make this function run like shit
ive been trying to use array for days now and it just rapes me in the ass even more with errors
def check_for_replies():
check_this = str(get_shitpost())
#find a way to not have to manually make it check multiple times
num_of_hits = len(re.findall('>>8\d{5,}', check_this))
new_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), check_this, 1)
if num_of_hits == 2:
new2_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new_check_this, 1)
return new2_check_this
if num_of_hits == 3:
new2_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new_check_this, 1)
new3_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new2_check_this, 1)
return new3_check_this
if num_of_hits == 4:
new2_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new_check_this, 1)
new3_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new2_check_this, 1)
new4_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new3_check_this, 1)
return new4_check_this
if num_of_hits == 5:
new2_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new_check_this, 1)
new3_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new2_check_this, 1)
new4_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new3_check_this, 1)
new5_check_this = re.sub('>>8\d{5,}', ">>" + get_random_reply(), new4_check_this, 1)
return new5_check_this
# num of hits can be a huge number and id still have to write more of these
>>
>>59680723
that is very nice
>>
>>59680704
The fuck?
Is this ironic or just retarded?
>>
File: 1489535896861.jpg (1MB, 1165x826px) Image search: [Google]
1489535896861.jpg
1MB, 1165x826px
>>59680474
>>59680512
Hmmm both land of lisp and SICP look interesting. I'm not sure which one would be better to use.
>>
>>59680793
well gee, i dunno
>>
>>59680704
Just because you can use nmap doesn't make you a hacker, idiot
>>
>>59680785
LOL did he take it offline?
>>
>>59680772
Does it hurt you when you see people use Rust?
>>
>>59680814
I'm just worried about their mental health
>>
>>59680809
No, server is down for maintenance.
>>
I'm at my wits end, it's sort of self explanatory what I'm trying to do here. Problem is that whenever -1 is entered it's being counted as a value and as the low number when it's obvious what I want -1 to do instead. Can I get some help without a total spoonfeed? Learning this stuff is actually interesting.

{
int high, low, sum = 0, i, count;
double avg;
printf("Enter a number (-1 to quit): ");
scanf_s("%i", &i);
high = i;
low = i;
for (count = 1; i != -1; count++)
{
printf("Enter a number (-1 to quit): ");
scanf_s("%i", &i);
if (i > high) {
high = i;
}
if (i < low) {
low = i;
}
sum += i;
}
avg = (double) sum / count;
printf("\nThe lowest number was %i\n", low);
printf("The highest number was %i\n", high);
printf("The number of values entered was %i\n", count);
printf("The average of the numbers was %.2lf\n", avg);
}
>>
>>59680786
Have you never heard of a loop?
>>
>>59680823
I'm worried about your mental health to be quite honest
>>
File: 1488783918868.png (141KB, 502x502px) Image search: [Google]
1488783918868.png
141KB, 502x502px
>>59680785
>>59680704
I take back what I said, its offline kek

good job hacker man
>>
>>59680704
Congratulations, you found the unmasked IP address

Unfortunately in doing so you disclosed your e-mail address
>>
>>59680833
>if i == -1 exit
>while i != -1
>>
>>59680833
>Can I get some help without a total spoonfeed?
The order in which you are doing things is wrong.
Think about what your code is doing after you enter the second number.
>>
>>59680847
>>59680846
>>59680809
>>59680806
I actually don't know why its offline.

I didn't do anything
>>
What is software/computer engineering/computer science academia like?
>>
>>59678162
>>59678365
>>59679380

Why are you all testing for divisibility rather than just counting by 14?

for(int i = 0; i < 200; i += 14)
{
printf("%d\n", i);
}


>>59679448

I worked through SICP with Guile and had no problems, though MIT Scheme would probably be the canonical choice.
>>
>>59680833
    for (count = 1; i != -1; count++)
{
printf("Enter a number (-1 to quit): ");
scanf_s("%i", &i);
/* The value of i just changed. It might be -1 now. */
if (i > high) {
high = i;
}
if (i < low) {
low = i;
}
sum += i;
}
>>
>>59680864
What webserver are you running?
You using CGI?
>>
>>59680833
>scanf_s
just use scanf, atoi, or strtol, not this microsoft bullshit
>>
>>59680913
no im the autist who run nmap on drawy.io

please no hate, i am curious
>>
>>59680870
a wankfest of incompetence breeding more incompetence like most of """"""""""""higher learning""""""""""""""
>>
>>59680936
Maybe you were possessed by the great hacker 4chan
>>
>>59680901
>>59680863
I'm dumb, thanks a ton.
>>
rate my flatten
it's the best i could do after brainstorming for 20 minutes and making sure i wasn't entering syntax errors
the first time i tested it, it worked, so that was nice
[207] pry(main)> def flatten list
[207] pry(main)* list.each_with_index do |element, index|
[207] pry(main)* if element.class == [].class
[207] pry(main)* list.delete_at(index)
[207] pry(main)* element.each do |e|
[207] pry(main)* list.insert(index, e)
[207] pry(main)* end
[207] pry(main)* end
[207] pry(main)*
[207] pry(main)* end
[207] pry(main)* if list.any? do |element|
[207] pry(main)* element.class == [].class
[207] pry(main)* end
[207] pry(main)* flatten list
[207] pry(main)* end
[207] pry(main)*
[207] pry(main)* list
[207] pry(main)* end
=> :flatten
[208] pry(main)> flatten [1, 2, [3, 4], 5, 6]
=> [1, 2, 4, 3, 5, 6]
[209] pry(main)> flatten [1, 2, [3, 4], 5, 6, [[7]]]
=> [1, 2, 4, 3, 5, 6, 7]
[210] pry(main)>
>>
>>59680870
A bunch of nondescript white people stand around and jerk eachother off over knowing what things mean without really appreciating why or how and make pseudo-profound statements to shoot down people's ideas making themselves feel smart

I suspect they want to turn technology into the cool kids club because they never fit into other groups
>>
https://youtu.be/LA_DrBwkiJA
Crazy shit
>>
>>59681006

> hey proffessor what is 4chan dpt like
> "A bunch of retarded 12 year olds making vague statements about our computer science department"
>>
>look into rust opengl bindings
>all the rustified ones are basically broken, incomplete, or specific subsets
>the one binding that gives all the functionality needed requires you to basically use unsafe {} everywhere

why did I even waste my time with rust
>>
File: 56+859+.png (69KB, 540x354px) Image search: [Google]
56+859+.png
69KB, 540x354px
I'm trying to make an Image Viewer in C++.
I have almost no knowledge about c++ or programming in general.
already got GTK+, but what other libraries could i need? i'm using bloodshed dev++ IDE
>>
>>59681027
You know it's true though

About 98% of compsci """"academics"""" don't know or care how things work and why it's a good idea to use it and just jerk themselves off for being able to parrot information someone else gave them
>>
https://www.securecoding.cert.org/confluence/plugins/servlet/mobile#content/view/2130132

Reminder to everyone who uses C, you should not use system() just as you do not use gets().
>>
>>59680901
>>59680863
Actually there's one more problem I'm having that I just can't figure out. When -1 is being entered to quit, it's still counting towards my count variable making the average all fucked up. I tried different things and have no clue here.
>>
>>59681033
we told you its a meme.
>>
>>59681043
>Image Viewer in C++
http://www.cplusplus.com/forum/lounge/192696/
>>
>>59681033
Everyone told you not to
>>
>>59681033
Memory safety is a red herring. Rust is a fraud. Don't let the SJWs talk you into it. If it takes over the industry like Java did, we're all doomed.
>>
>>59681043

You don't ever need to write a library to read an image format

If you wanted to view a PNG for example, you use libPNG because it will compile to any platform and is as fast as it gets

So you end up just reading the image files with a library that already exists and writing them to your screen
>>
>>59681033
Did you try glium? It seems pretty complete to me. OpenGL is pretty much impossible to directly translate into safe Rust by design.
>>
>>59681145
>by design
Rust was specifically designed to not translate to opengl?
>>
>>59681085
The count++ is going to get run after every loop, including the one you entered -1.
The "easy" fix would be to just subtract 1 from count after the loop.
>>
>>59679521
I mean.. Shouldn't this be possible?

 Let point be defined thus
Let a point have integers called x and y
Thus concludes the definition of point

is the same as
class point
{
int x, y;
};

So maybe not a "language" per se, but it should be possible to have an "english to C++" 'approximate-er' ... Sounds like an interestign project
>>
>>59681184
why do you do this to yourself?
>>
>>59681180
That is a fix I thought of but I mean would there be a different way to do this where the count wouldn't get messed up at all?
>>
>>59681043
do it in asm
https://www.youtube.com/watch?v=pnBT7TqLSPc&list=PL0C5C980A28FEE68D&index=26
>>
>get college to recognize my babyboi status as protected
>profs, classmates at my extremely liberal don't dare to say anything about it
>exam time
>o no have to make potty in my nappy
>>
>>59681016

you can probably put a program in a PDF because they support javascript and writing to the screen.

it's not hard to write an interpreter for basic 1975 level Intel assembly in Javascript
>>
>>59677821
I'm trying to figure out how to pass a string as an argument for a funtion that removes vowels.
def remove_vowels(s):
vowels="AEIOUaeiou"
emptystring=""
for i in s:
if i not in s:
emptystring+=i
return emptystring


My idea here is that remove_vowels(Apple)
would return 'ppl'. But instead I get a NameError telling me Apple is not defined. What am I doing wrong? I thought the s was just a stand in for anything I pass into the function, what am I missing?
>>
>>59681204
Start count from 0 instead of 1, but that's a slightly less obvious solution.
You could also break from the loop early if -1 is entered, which will never run the count++ bit.
>>
>>59681210
>letting an aussie teach you asm
>>
>>59681195
Do what?

>>59681221
It might be a simple fix:
remove_vowels("Apple")


or
apple = "Apple"
remove_vowels(apple)

Or I might be completely full of shit. Let me know if this fixes it
>>
>>59681246
>mfw 99% asm tutorials is useless x86 garbage from 90s and aussie is the best we have
>>
>>59680990 (You)
shorter but with a glitch, because Ruby's Array.slice works differently than Javascript's

[213] pry(main)> def flatten2 list
[213] pry(main)* list.each_with_index do |element, index|
[213] pry(main)* if element.class == [].class
[213] pry(main)* list = list.slice(0, index) + flatten2(element) + list.slice(index + 1, list.length)
[213] pry(main)* end
[213] pry(main)* end
[213] pry(main)*
[213] pry(main)* list
[213] pry(main)* end
=> :flatten2
[214] pry(main)> flatten2 [1, 2, 3]
=> [1, 2, 3]
[215] pry(main)> flatten2 [1, 2, [3]]
=> [1, 2, 3]
[216] pry(main)> flatten2 [1, [2, [3]]]
=> [1, 2, 3]
[217] pry(main)> flatten2 [1, [2, [3], []]]
=> [1, 2, 3]
[218] pry(main)> flatten2 [1, [2, [3], []], [[[5]]]]
=> [1, 2, 5, [[[5]]]]
[219] pry(main)>
>>
>>59681221
In most programming languages, strings have to be wrapped in quotation marks (e.g. remove_vowels("Apple")). Otherwise, they're treated as identifiers.
>>
I'm working on a Python program that prints 'Hello World'
>>
>>59681184
>let type point define as
>let point have integer x & y
>end

Honestly how do you people miss the point of dictated programming.
>>
>>59681311
First time I've heard of it, so I don't know the point you're trying to make.
>>
>>59681140
>You don't ever need to write a library to read an image format
>If you wanted to view a PNG for example, you use libPNG because it will compile to any platform and is as fast as it gets
>So you end up just reading the image files with a library that already exists and writing them to your screen

Thanks a lot, i suppose that i'll just look for a library for each format, i'll just implement the most common.

>>59681099
>>Image Viewer in C++
>http://www.cplusplus.com/forum/lounge/192696/
isn't pretty gay if i see how someone else does it.

>>59681210
i wish i could, i wanted to make a basic calculator with GUI but i barely could do a simple hello world also i'm in win x64 and almost all the tutorials and examples are for x32.
>>
>>59680427
>importing 100000 other functions for no good reason
>>
>>59681174
No, but you can't pass raw pointers around unless you use an unsafe block, which is what you need for the OpenGL API. But what you can do is contain all the unsafe calls within a wrapper that provides a safe interface.
>>
>>59681332
You clearly don't know how linking or the standard library works.
>>
Is it shameful for a "professional" programmer to google about certain features from a programming language, because he currently doesn't remember said features? I am still a rookie, but I tend to forget some small features from time to time. I was wondering if it was something normal.
>>
can anyone help me, this won't loop
import java.util.Random;
import java.util.Scanner;

public class GuessingGame {

public static void main(String args[])
{
//introduce the game
System.out.println("This program will allow you to guess a");
System.out.println("number between 1-100! Enter 0 to quit.");
System.out.println();

//declare variables and instantiate methods
Random generator = new Random();
Scanner scan = new Scanner(System.in);
int guess = 0;
int actualValue = 0;
String again;

//give the actualValue a value with random
actualValue = generator.nextInt(100) + 1;

//the games starts here
do
{
do
{
//get user input
System.out.println("Please enter a number(enter 0 to quit): ");
guess = scan.nextInt();
System.out.println();

//if else
if(guess < actualValue && guess != 0)
System.out.println("TOO LOW!");
else if(guess > actualValue && guess != 0)
System.out.println("TOO HIGH!");
else if(guess == actualValue)
{
System.out.println("Right Number!");
break;
}
}
while(guess != 0 || guess == actualValue);

System.out.println("Do you want to play again? (y/n)");
again = scan.nextLine();
}while (again.equals("y"));

//System.out.println("Thanks for playing!");

scan.close();
}
}
>>
>>59681364
If rather have you look it up than have you guess and do it wrong.
>>
messin wit arrays.
any way to make this more clean or is c++ always this much of a clusterfuck


[$code]
#include<iostream>
#include<string.h>
#include<fstream>
#include<vector>
using namespace std;
int main()
{
double average, gradesum;
int num_students,num_quizes;
cout<<"Please input the amount of students\n";
cin>>num_students;
cout<<"Please input the number of quizes each student has\n";
cin>>num_quizes;
int id[num_students];
int grade[num_students][num_quizes];
for (int i=0; i < num_students; i++)
{

cout << "Please enter your ID\n";
cin>>id[i];
for (int j = 0; j < num_quizes; j++)
{
cout << "Input your grade for quiz" << endl;
cin >> grade[i][j];
}
}

//Here is where the grades will be output and associate the grades with the IDs accordingly

for (int i = 0; i < num_students; i++)
{
cout<<"ID#:"<<id[i]<<endl;
for (int j=0; j < num_quizes; j++)
{
cout << grade[i][j] << endl;
}
}

gradesum=0;
for (int i = 0; i < num_students; i++)
{
for (int j=0; j < num_quizes; j++)
{
gradesum=gradesum + grade[i][j];
}

}
average=gradesum/(num_quizes*num_students);
cout<<"The average grade for "<< num_students<<" students was "<<average<<"%"<<endl;
system("pause");
return 0;
}
[/$code]
>>
>>59681325
The least amount of pointless fluff to parse. Especially since voice is infinity harder.

also with a return type
You could even shorter with
>define type point with integer x and y
>return auto
>end
>>
>>59681382
Rewrite it in C.
>>
>>59681380
I guess that would be a logical answer lol.
>>
How does this make you feel, /g/?

unsigned i, j, k, l;
for (k = 0; k < pz->size; k += pz->sq) /* box */
for (l = 0; l < pz->size; l += pz->sq)
for (i = 0; i < pz->sq; i++)
for (j = 0; j < pz->sq; j++)
box[k/3][l/3] |= (1 << (pz->arr[k+i][l+j] - 1));
>>
>>59681386
Don't use C
>>
>>59681382
please use hastebin for anything over ~20 lines
>>
>>59681357
i do not, no :)

does it link only what u call @ compile time?
>>
>>59681393
Explain to me why vectorized operations are bad /g/. This is disgusting.
>>
>>59681386
>>59681394
c scares
>>59681399
ok
>>
What is the definitive best algorithm book? I want to learn everything about Big O notation, and all the fancy/useful algorithms. Also, if you guys would tell me the math required so I can research it while I learn the book, so I don't get stuck with it, would be incredibly appreciated it. Thanks in advance.
>>
>>59681382
>>59681321
>>59681397
Learn how to use code blocks you fucking illiterate piece of shit. Read the sticky.
>>
File: 1458626540237.png (24KB, 240x240px) Image search: [Google]
1458626540237.png
24KB, 240x240px
how would one find the index of an item in a list, assuming all that you know is the item directly before it?
list = [1,2,4]
for example, I want the index of 4 but all I know is that it comes directly after 2.
>>
>>59681393
>no clue, what are pz, sq, size, box
>>
>>59681403
When you're writing a (hosted) C program, the whole standard library is already linked into your program.
By including a header, you're not "pulling in" extra functions, you're just bringing their declarations in.

It's wrong to think that "one header file == one library".
>>
>>59681429
return list[list.indexOf(2)+1]
>>
>>59681415
I am a noob at programming, but isn't C++ considered more challenging than C? What the hell are you scared off?
[spoiler] I know you are memeing [/spoiler]
>>
Going to write the 4chan thread image harvester suggested in the challanges picture. I'm doing it in Python, partly because I have to learn the reason for school related reasons. Do you have any suggestions for libraries I can use? Or recs for how to go about it really. I have little experience with web related stuff.
>>
>>59681461
Beautifulsoup and regular expressions
>>
>>59681429
auto int = list[2]
>>
>>59681439
>I am a noob at programming, but isn't C++ considered more challenging than C?
It's a well known fact.
C babbies lack the attention span to read a book more than 300 pages
>>
>>59681471
Hey, thanks! Even found this, which looked intruiging: http://web.stanford.edu/~zlotnick/TextAsData/Web_Scraping_with_Beautiful_Soup.html
>>
>>59681373
no one wants to help this noob, I love C++, and C
>>
>>59680870
I went to school for CE where all the professors did research. Off the top of my head, one created/used micro satellites for the government, one worked exclusively in the on campus nanotech fab on graphene/carbon nanotubes/micro labs/ETMs, one did low power computing designs/parallel computing architecture, one did theoretical computational geometry/simulation design, one was basically the top five in his field in robotic designs, ect. It was great, since they constantly held talks where people from all over the industry came in and as an undergrad I could sit in on them.
>>
>>59681417
CLRS
>>
>>59681373
shit left in the inbuffer i'm sure
instead of enter, hit eof: CTRL+Z on windows for example
>>
>>59681489
beautifulsoup is basically magic, you can probly handle 4chins with a json parser though without it. BS is like a good version of an old perl library.
>>
>>59681517

Did you go to MIT or something?
>>
>>59681476
I'm proficient in both C and C++.
I learned C++ and have a better grasp on it.
I prefer C.
Fuck off.
>>
>>59681520
>CLRS
Oh nice, that was the book I was considering. I already found the pdf and everything. One question though, should I finish learning all the "syntax" from my programming language of choice. Or should I read it(algorithms book) while learning said programming language at the same time?
>>
>>59681557
Concurrently.
>>
>>59681555
learned C++ first *
>>
>>59681548
all professors do research in their fields
that's kind of the point of being a professor
>>
>>59681282
hmmm. I tried passing it like remove_vowels("apple"). I also added print(emptystring) to the end of the function.

No more error but now it's not printing anything at all.
>>
>>59681555
Why does C get so much hate from people? I thought it was hailed as one of the best programming languages ever created, I mean, it's old as fuck, and people still use it. Are people just memeing? Or C completely sucks?
>>
>>59681567
his point was most professors arent doing that kind of exciting work.
>>
>>59681564
>Concurrently
Awesome, thanks anon, gonna start tonight. Any tips before I dive? Math tips? Anyways, I am going in.
>>
>>59681555
>I prefer C.
Because it's easy for you to use. I don't care what you prefer.
Fuck off.

>>59681578
C is over rated.
>>
File: AAAAAAA.png (576KB, 531x720px) Image search: [Google]
AAAAAAA.png
576KB, 531x720px
I thought my sudoku solver didn't work all afternoon, it turns out i forgot to return success so my program kept retrying forever and never finishing.

I'll post it next thread!
>>
>>59681578
C is one of the easiest raw assembly abstraction languages ever made. Take that how you will.
>>
>>59681578
It's just now begging to be exhumed

It took the software community a while to realize it but you have the ability to create situations in C that you would literally never want. All the time. You're constantly walking a tightrope of memory management that can completely break the whole system.

Rust is basically now being championed by the replacement.
>>
>>59681592
complete inability to debug is a major issue
you need to work on that
>>
>>59681590
>C is over rated.
Can you please tell me why you think so? Also, what are your programming languages of choice, and why are they superior to C? I will take a stab at it, and guess that you like Haskell.
>>
>>59681588
Just take your time with it. Don't get discouraged with the proofs.
>>
File: 1491010393480.jpg (226KB, 869x1776px) Image search: [Google]
1491010393480.jpg
226KB, 869x1776px
>>
>>59681608
Wouldn't C++ be a better replacement? Or does it fall in the same category as C(having way too many unnecessary ways to shoot your foot)?
>>
>>59681635

not even real
>>
>>59681619
C is for lesser programmers. Writing C is an insult to an intelligent person. No one has time to babysit C to have basic functionalities instead of actually working with the problem at hand.
>>
>http://harmful.cat-v.org/software/c++/coders-at-work
is C++ the shittiest language there is?
>>
>>59681635
To be fair the left is an approximation and I would also be scared if someone used such things in flight software.
>>
>>59681635
Is the part of "guise' code" meant to be """impressive"""?
>>
>>59681609
wouldnt happen if he were using a pure language.
debugging is literally a meme
>>
>>59681649
Not by a long shot, but it was pretty shitty for decades.
>>
>>59681640
C++ is just a bad language in the same way PHP is a bad language. It's an endless rabbithole of stupid and inconsistent that makes managing the project on a large scale near impossible

That's my understanding anyway. I don't write C++
>>
>>59681578
C is pretty much assembly with the addition of automatic register management and a cross-platform API layer over syscalls. Yeah, it "sucks," but if you put in enough work, you can do anything with it, and you can do it as efficiently as you can possibly imagine -- unlike higher level languages, which are designed to perform certain subsets of "anything" as efficiently as you can possibly imagine, and can also do other things, but don't do them very efficiently at all.
>>
NEW THREAD!!

>>59681677
>>59681677
>>
>>59681586

I honestly don't know what proffessors or undergrads do
>>
>>59681590
>Because it's easy for you to use.
Wrong. C++ is easier for me to use. I prefer C.
Fuck off.
>>
>>59681657
To be fair every floating calculation that a computer calculates is an approximation
>>
>>59681626
Thanks anon. I will keep that in mind.
>>
>>59681608
The situations you're talking about are documented. They're called "undefined behavior."

Don't do them.

There. Easy as that.
>>
>>59681699
I don't prefer C. And C is easier for me to use.
Fuck off.
>>
>>59681715
>The situations you're talking about are documented. They're called "bugs".

>Don't make them them.

>There. Easy as that.
>>
>>59681722
You said "C babbies lack the attention span to read a book more than 300 pages."
Your preferences are unrelated to the fact that my preferences prove you wrong on in regard to having said that.
Fuck off.
>>
File: 2b8.png (70KB, 320x240px) Image search: [Google]
2b8.png
70KB, 320x240px
>>59681732
>the sisutaiton are calld bad
>no do an bad
>>
>>59681736
>You said "C babbies lack the attention span to read a book more than 300 pages."
Not him but it's true.
>Your preferences are unrelated to the fact that my preferences prove you wrong on in regard to having said that.
No, my preferences prove you wrong.
Fuck off.
>>
>>59681715
It's a situation that you would literally never want.

Just because it's more complicated doesn't mean it's more complicated for good reason.

Also, just "not doing it" requires you to be needlessly roundabout.

Honestly, this is such a basic concept regarding computers and how it works it's painful that you would need to justify it. See here >>59681061
>>
>>59681747
My claim is that my preferences prove people who prefer C do not categorically lack the attention span to read a book more than 300 pages.
Your preferences do not prove that my preferences do not prove this.
Fuck off.
>>
>>59681763
>My claim is that my preferences prove people who prefer C do not categorically lack the attention span to read a book more than 300 pages.
Yeah and you are wrong. C tards really can't learn C because they are scared of big books.
>Your preferences do not prove that my preferences do not prove this.
Wrong again
Fuck off
>>
>>59681777
can learn C++*
>>
>>59681777
>Yeah and you are wrong. C tards really can't learn C because they are scared of big books.
But I prefer C and I learned C and I also learned C++.
>Wrong again
no u
fcjuk ofb
>>
so is literally every language a waste of time
>>
>>59681793
Going to C from C++ is easy, going to C++ from C is not possible because C is corrosive to brain.
Fuck off.
>>
>>59681802
>>
>>59681809
First of all, I maintain a continuing working knowledge of both.
Secondly, that doesn't matter, because I prefer C, and I learned C++, and therefore your claim that people who prefer C can't learn C++ is false.
fib forb
>>
>>59681548
No, was U of I, not esp. well known but a huge research institution. Lots of collaborative projects between the different engineering departments/government/private sector. One friend did work designing a system to download the massive pictures from the radio telescope in I want to say Chile to process them using the supercomputer there. Another did work for the nanotech dude looking into the research done to synthesize carbon nanotubes using iron spheres. List goes on, many also did internships ect. I got lucky to even get in.
>>
>>59681827
re read >>59681809
>>
>>59681875
What you said there doesn't actually matter. You said "C tards really can't learn [C++] because they are scared of big books." I am a "C tard." I learned C++. Therefore, "C tards really can't learn [C++]" is untrue. The fact that I learned C++ *first* is irrelevant.
Thread posts: 341
Thread images: 34


[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.