[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: 315
Thread images: 35

File: hidamari_dpt_waifu2x_traps.png (2MB, 1618x1308px) Image search: [Google]
hidamari_dpt_waifu2x_traps.png
2MB, 1618x1308px
Old thread: >>61233495

What are you working on, /g/?
>>
workin on line bots
>>
File: 1499044828671.jpg (86KB, 600x571px) Image search: [Google]
1499044828671.jpg
86KB, 600x571px
>>61239352
>Now with anime.
Well at least we had some code going in the last thread.
>>
Fuck anime faggots, reposting

for(unsigned long i = 1; i <= LONG_MAX; i <<= 1){ 
int clz = __builtin_clz(i) + __builtin_clz(i - 1);
printf("%lu: %i\n", i, clz);
}

for(unsigned long i = 1; i <= LONG_MAX; i <<= 1){ 
int clz = __builtin_clz(i)
clz += __builtin_clz(i - 1);
printf("%lu: %i\n", i, clz);
}


Can anyone compile this code and try it? I think I'm going crazy, I get 2 different outputs, can anyone explain? No optimizations applied, gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406.
>>
>>61239315
>>61239378
Print __builtin_clz(i - 1), __builtin_clz(i), and __builtin_clz(i) + __builtin_clz(i - 1). See which one differs.
>>61239330
My alternatives are:
libtorrent-rasterbar (very well documented library), C++
libtorrent-rakshasa (don't know how well documented but not as good), C++
libtransmission (not documented at all besides from some comments in header files), C
various python libraries (all in beta and last updated years ago)

libtorrent-rasterbar seems best.
>>
File: 1491847159000.jpg (28KB, 720x645px) Image search: [Google]
1491847159000.jpg
28KB, 720x645px
do "people" still shill rust or are they on vacation
>>
>be C programmer
>start getting into C#/.NET
>actually seems feasible to do large projects on my own without spending my entire life debugging

Managed languages are the future.
>>
>>61239343
Thanks for using anime picture.
Also, Ruby is a comfy language.
>>
>>61239343
>upscaling a jpg image
fucking hell it looks terrible, get the original and restore it then upscale it
Do you have the unedited one?
>>
>>61239378
Looks normal to me.
>>
>>61239378
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
>Built-in Function: int __builtin_clz (unsigned int x)
>Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined.
>__builtin_clz(i - 1)
>where i can be 1
>"If x is 0, the result is undefined."
There's your problem.
>>
>>61239381
>Print __builtin_clz(i - 1), __builtin_clz(i), and __builtin_clz(i) + __builtin_clz(i - 1). See which one differs.

The sums differ for 1, where it's 31 and 0 vs 62 and from 2^32 upwards, where it gets -183716000 for summing them in the same line.
>>
>>61239397
anime always looks terrible
>>
>>61239343
So original reusing the same pic as yesterday.
>>
>>61239430
RTFM dumb shit
>>
>>61239383
>managed
Languages are not managed. If you are a shitty C programmer that is your fault.
>>
>>61239343
>make a nice /dpt/ logo
>put text on it
>the text is all about who we don't want here
wow you must be a happy human being
>>
>>61239420
It gets weird at 2^32 and higher.
Use #include <limits.h> for LONG_MAX.

>>61239421
That makes no sense, because after 2^32 none of the 2 halves of the number are 0.
>>
>>61239448
After 2^32 you get overflow.
>Built-in Function: int __builtin_clz (unsigned int x)
It takes an int.
It doesn't matter that your i is a long, it takes an int anyway.
If you pass a long, it will be implicitly cast to an int, resulting in overflow, in turn resulting in repetition of test cases.
>>
>>61239448
Just make everything long long
>>
>>61239448
>>61239484
sure is summer

use __builtin_clzl

for fuck's sake

https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
>>
>>61239484
That won't help. See: >>61239480
>>
>>61239491
Ok I guess I'm retarded, thanks. Didn't find that.
>>
File: 1478655335751.jpg (188KB, 900x1000px) Image search: [Google]
1478655335751.jpg
188KB, 900x1000px
Question regarding Visual Studio Community:
Is there a downside to using the 2013 version instead of the 2017 one?
I don't want to install anything on my Win7 laptop that has the touch of death of Microsoft post Win10 if I can help it.
>>
File: The Correct Image.png (389KB, 934x1000px) Image search: [Google]
The Correct Image.png
389KB, 934x1000px
>>61239432
There is only one correct OP image.
>>
>>61239558
>>
>>61239558
That image is gay.
>>
>>61239492
int countleadingzeros(int toCount){
for (int i = 64; toCount & 1 << i | i == 0; i--) {}
return i
}

good enough
>>
>>61239558
This.
>>
>>61239586
it aint
the guy needed one that takes a long
yours still takes an int
>>
File: basic.gif (49KB, 602x650px) Image search: [Google]
basic.gif
49KB, 602x650px
What's the most sneaky way to trick normalfag phone users to do a grabcut for image segmentation?

>drag a box around the foreground object
>color in the foreground object
>tap a few points on the foreground object
Any other ideas to trick the normies?
>>
File: 1496664905878.jpg (28KB, 337x337px) Image search: [Google]
1496664905878.jpg
28KB, 337x337px
>>61239491
>>61239519
Ok thanks a lot, managed to do what I needed.
int clzl = __builtin_clzl(x);
int size = (sizeof(x - 1) * 8 - clzl) / 8 + (clzl % 8 != 0);

Calculates the size in bytes needed to represent a number.
>>
>>61239615
how far squidways goeth your nose
>>
>>61239607
long countleadingzeros(long toCount){
for (int i = 64; toCount & 1 << i | i == 0; i--) {}
return i
}
>>
File: 19248024jpg.jpg (12KB, 320x237px) Image search: [Google]
19248024jpg.jpg
12KB, 320x237px
>>61239382
What if there was a Rust based language that doesn't shove all these security measures on your throat

A language with
- ADT
- Pattern matching
- Currying
- HKTs
- Callbacks / Closures / Delegates
- No automatic pointer de-referencing
- No Classes, only structs and impls
- No :: and No < >
- Templates, Mixins and CTFE
- No GC
- RAII
- UFCS
- Abstraction with no runtime overhead
- Lazy iteration tools
- Compiles to LLVM IR
>>
>>61239639
>>
File: 1499000199637.jpg (98KB, 581x593px) Image search: [Google]
1499000199637.jpg
98KB, 581x593px
>>61239639
>unironically using a loop to do what a single instruction can do in silicon
>>
>>61239643
Half of these are anti features.
>>
>>61239668
Which one?
>>
>>61239666
>posting disfigured faces to call people stupid
>being this insensitive to intelligent people with disfigured faces
>>
>>61239615
Can't you just use sizeof to get the number size in bytes?
>>61239666
The compiler will optimize it, someone else's problem.
>hand optimized code will never be relevant again
why even live
>>
>>61239643
Oh and just for keeping brainlets out: No for loops, only loop { }
>>
>>61239683
>Can't you just use sizeof to get the number size in bytes?
That gets the size of the type
The point is to get the minimum size needed to represent the object losslessly in any type, regardless of what type currently holds it
>>
>>61239690
>Oh and just for keeping brainlets out: No for loops, only loop { }
but that would make the language less expressive
>>
>>61239683
>Can't you just use sizeof to get the number size in bytes?
I use it for packing an array, if I know my max value is going to be something like 4398046511002 I would like to know it only needs 5 bytes, not the full 8 it's currently in.
>>
>>61239712
use sequtils instead of for. And for maths use loops
>>
>>61239668
>no gc
You're deluded if you believe you won't benefit from an optional gc in your language
>raii
This should not be forced on the user either, esp since it restricts symbols' lifetime to the scope of the owning object.
>no classes
How is that bad? Fundamentally with UFCS the usual classes are structs that can hide their fields.
>abstraction with no runtime overhead
Aka losing portability
>>
Im trying to get familiar with MIPS assembly.

I made this as an attempt to create my first function, and it seems to work fine, but is it cancer?

# multiply two unsigned words
# v0 = a0 * a1
# adds a0 a1 times
multiplyu:
li $v0, 0
multiply_loop:
beqz $a1 exitMultiply
add $v0, $v0, $a0 # v0 = v0 + a0
sub $a1, $a1, 1
j multiply_loop
exitMultiply:
jr $ra

can someone point me in the right direction on the real proper multiplication done by people smarter than me, like with signs n shit?
>>
>>61239751
>>61239671
Misquoted but it's not exhaustive
>>
>>61239615
int getRequiredSize(long number) {
!number&&return 0;
int neededBytes = 8;
while(!(0xFF << neededBytes*8)) {
neededBytes--
}
return neededBytes;
}
>>
File: 1493936129463.jpg (97KB, 1024x768px) Image search: [Google]
1493936129463.jpg
97KB, 1024x768px
>>61239690
>using anything but pure x86 in real mode on ring 0
>not knowing true freedom
>>
>>61239797
int getRequiredSize(long number) {
!number&&return 0;
int neededBytes = 8;
while(!(number & (0xFF << neededBytes*8))) {
neededBytes--
}
return neededBytes;
}
>>
>>61239800
wtf?
>>
>>61239810
>>61239797
Slow as shit, might as well use javascript.
>>
What OS does Ruby use?
>>
>>61239751
Classes are useless if you have structs, impls and traits
>>
>>61239683
>The compiler will optimize it
Probably not.
>>
File: Screenshot_20170703-215729.jpg (242KB, 648x792px) Image search: [Google]
Screenshot_20170703-215729.jpg
242KB, 648x792px
There is never a good reason for high level exception handling prove me wrong.
How a C programmer gets around quicksand:
>use your fucking eyes and observe that there is quicksand
>walk around it
>continue on your way
How a C++ or Java programmer gets around quicksand:
>fall into the quicksand
>struggle your way out of it
>continue on your way
Pic related: anime
>>
>>61239683
Compilers can't optimize away the retarded dev, yet.
>>
>>61239846
Stop living in the 70's grandpa
How a modern programmer gets around quicksand:
>use your fucking eyes and observe that there is quicksand
>walk around it
>if you fall into the quicksand {
>struggle your way out of it }
>continue on your way
>>
>>61239846
People use exception handling because it makes handler errors much easier rather than percolating the error upwards. A big grip people have with go is that it has primitive exception handling and you constantly have to have if err != nil {} which gets annoying.
>>
>>61239846
How an assembly programmer gets around quicksand:
>undergo mitosis
>walk in all directions at once
>whoever doesn't fall in the quicksand gets to live
How a Rust programmer gets around quicksand:
>observe that there is quicksand
>panic loudly from a safe distance for 5 hours
How a Haskell programmer gets around quicksand:
>observe that there is no quicksand
>>
>>61239846
When you don't know whether in.PajeetSoftwareDevelopment.app.CoreDisplayContainer.ReactorPooInstanceFactory.AllNodes(7) will work as intended or not.
>>
>>61239846
Handling error conditions in C fucking sucks. Proof: experience, of which I have more than you.
>>
>>61239932
This
>>
File: 1492279832599.png (101KB, 979x576px) Image search: [Google]
1492279832599.png
101KB, 979x576px
Which one should you choose in these situations?
>>
>>61239941
this
>>
>>61239846
How a Common Lisp programmer gets around quicksand:
>use your eyes and observe that there is quicksand
>test the waters and analyze the pit
>determine whether walking around it, struggling through it or building a bridge yields the most efficient way of passing the quicksand
>do as concluded
>continue on your way
It's a disgrace that no language has yet to surpass CL's condition system.
>>
>>61239941
I used to believe this. With even more experience, the issue has been muddied for me. Exception are often convenient in simple situations, but in certain more complex situations they start sucking a lot more. I'm not even sure which I'd choose given the entirely free choice.
>>
what's the best C++ and javascript references?
>>61239967
isn't hackers delight just bit twiddling? i read a little of a pdf i downloaded of it
>>
>>61240015
Given the choice, I would use a language that gives the programmer the power to define their own complex control flow constructs.
>>
File: 1374577599111.png (318KB, 664x602px) Image search: [Google]
1374577599111.png
318KB, 664x602px
>>61239432
>>61239558
I normally try to rotate the images I post a bit, but due to know anti-anime the last OP was, I went with the most anime pic I had.
>>
>>61239941
I'm coming from the world of Java where everything and someone's grandmother can be caught as an exception. Error handling in C appears to be on the side of "the user isn't that stupid".

I need to get into the weeds of it more. There's a lot I don't know.
>>
>>61239751
>You're deluded if you believe you won't benefit from an optional gc in your language
There is a C library that can provide a GC to any language that needs it.

>it restricts symbols' lifetime to the scope of the owning object.
If a symbol has no owner, then logically it can't be used. Resources that are not in use should be destroyed, preferably in a way that can be consistently predicted. The most predictable manner to destroy resources is immediately when they are no longer usable. This isn't necessarily the fastest way to destroy them, but this is a factor that the programmer can optimize.

>Aka losing portability
Having no runtime overhead doesn't ruin portability at all. It just means that you have to compile a new binary for each platform.

>>61239829
Ubuntu.
>>
>>61239343
What is the point of interfaces?
>>
>>61240083
I'm just downloading the PDF to see what it's all about.
>>
>>61240177
>write a specification for something
>pajeet team a can implement stuff against it
>pajeet team b can implement it
as I was taught anyway
>>
How do you link in libraries in C++? The example code looks like this:
~/Documents/libtorrent/libtorrent-rasterbar-1.1.4> cat test.cc 
#include <iostream>
#include <thread>
#include <chrono>

#include <libtorrent/session.hpp>
#include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/alert_types.hpp>


They make references to a libtorrent/ directory. This is found in include/libtorrent/. How do I reference it in the source file? Do I just move the source file into the include directory?

test.cc:5:34: fatal error: libtorrent/session.hpp: No such file or directory
#include <libtorrent/session.hpp>
^
compilation terminated.
exit 1
~/Documents/libtorrent/libtorrent-rasterbar-1.1.4>
>>
>>61240221
>pajeet team a
>pajeet team b
There's more than one team??
>>
>>61240350
yes, one in mumbai and one in uttar pradesh
>>
>>61240166
R-Ruby senpai, what OS and WM do you use?
>>
>>61240151
>Error handling in C appears to be on the side of "the user isn't that stupid".
The user IS stupid though, and lazy. When was the last time anybody checked the return value of printf? How many C programmers check for malloc returning NULL?
>>
>>61240166
Are you fat Ruby? Do you have a beard? What colored eyes do you have? What is your favorite programming language?
>>
>>61240177
to separate the interface from the implementation

the user of the interface doesn't need to know about the implementation

you can provide better/different implementations of the same interface
>>
>>61240387
>The user IS stupid though
I don't debate that. I agree. I'm just saying Java appears to be easier to handle shit hitting the fan better than C.

Like I said, I need to experiment with C more. I could be just judging early.
>>
>>61240166
I want to use Ubuntu, but right now I am stuck with Gentoo :(
>>
File: 1497862008954.png (69KB, 1355x714px) Image search: [Google]
1497862008954.png
69KB, 1355x714px
What did he mean by this?
>>
>>61240513
it means your racist
>>
>>61240387
> When was the last time anybody checked the return value of printf?
Who the fuck cares what the return value of printf is? Either you've passed an invalid format string, which the compiler can easily pick up on anyway, or the underlying file has been closed, in which case, who the hell cares and what are you going to do about it?
>How many C programmers check for malloc returning NULL?
Actually, most C programmers do this. If you look at actual projects, this does happen.
If someone really doesn't give a shit about recovering from OOM errors, it's extremely likely they'll add an "xmalloc" function and use that instead.
void *xmalloc(size_t n)
{
void *ptr = malloc(n);
if (!ptr)
exit(1);

return ptr;
}
>>
>>61240531
>exit(1);
>not using abort();
why do I still live with all this suffering that I see?
>>
>>61240531
If someone really doesn't give a shit, why can't they just ignore the error?
>>
>>61240375
Ubuntu+Unity. I'm lazy.

>>61240392
I'm sort of a skinnyfat, I have a beard, my eyes are blue, and I prefer Ruby and C++.

>>61240232
Did you not install it through your package manager? Your compiler by default should look in /usr/include for headers, so the libtorrent folder with all of the *.hpp files should be installed to that directory. If you don't want to install it to your system directories, gcc and clang both use the -I flag (that's a capital 'i', not a lowercase 'L') can be used to tell your compiler to look in additional directories for headers.
>>
>>61240550
I want the proper exit functions to be called, buffers flushed, file descriptors closed, and all that to happen, though.
>>
>>61240578
>why can't they just ignore the error?
In an xmalloc function, you can log why your program closed unexpectedly.
Relying on a NULL pointer dereference and undefined behaviour is just bad form.
>>
>>61240579
No, I just compiled it and gave it the include directory manually. It worked though, but now something else (boost?) is acting up:
~/Documents/libtorrent/libtorrent-rasterbar-1.1.4> g++ test.cc -B . -std=c++11 -lboost_system
/tmp/cc62M7th.o: In function `main':
test.cc:(.text+0xc7): undefined reference to `libtorrent::default_storage_constructor(libtorrent::storage_params const&)'
test.cc:(.text+0x150): undefined reference to `libtorrent::session_handle::add_torrent(libtorrent::add_torrent_params const&)'
test.cc:(.text+0x178): undefined reference to `libtorrent::session_handle::pop_alerts(std::vector<libtorrent::alert*, std::allocator<libtorrent::alert*> >*)'
test.cc:(.text+0x303): undefined reference to `libtorrent::session::~session()'
test.cc:(.text+0x39a): undefined reference to `libtorrent::session::~session()'
/tmp/cc62M7th.o: In function `libtorrent::session::session(libtorrent::settings_pack const&, int)':
test.cc:(.text._ZN10libtorrent7sessionC2ERKNS_13settings_packEi[_ZN10libtorrent7sessionC5ERKNS_13settings_packEi]+0x62): undefined reference to `libtorrent::ipv6_deprecated_()'
test.cc:(.text._ZN10libtorrent7sessionC2ERKNS_13settings_packEi[_ZN10libtorrent7sessionC5ERKNS_13settings_packEi]+0x7a): undefined reference to `libtorrent::session::start(int, libtorrent::settings_pack const&, boost::asio::io_service*)'
collect2: error: ld returned 1 exit status
exit 1
~/Documents/libtorrent/libtorrent-rasterbar-1.1.4>
>>
>>61240531
>in which case, who the hell cares and what are you going to do about it?
According to POSIX printf can fail with ENOMEM, so by the same logic that you would check for malloc returning NULL, you should check the return value of printf.
>>
>>61240602
>relying on
Your program's behavior is undefined for when it's out of memory, simple as that.
>>
>>61240623
No it's not. There are programs that can run into OOM and need to be able to recover from it and keep operating.

>>61240613
It's not going to lead to any sort of bad memory references. You won't get a message shown, and that's it. Maybe that's a big deal to your program, but checking printf's return value sure as fuck isn't going to fix whatever the underlying problem actually is.
>>
>>61240579
W-Why do you like C++ and not C, senpai?
>>
>>61240613
>by the same logic that you would check for malloc returning NULL, you should check the return value of printf.
Why though?
If malloc returns 0, and you don't check it, you'll probably try to use it, resulting in undefined behavior. That's why to check it.
If printf returns ENOMEM, that won't invalidate anything else you try to do. Including trying to continue to print, which would be well defined, but just no longer useful, which is not a big deal.
>>
>>61240644
If you don't give a shit you can just call it undefined behavior.
>>
>>61240666
>666
gtfo satan
this is a christian board, no niggers, faggots, jews, trannies, or whores allowed
>>
C itself is undefined behavior
>>
>>61240687
Or you can write a fucking 5 line function which solves the problem and allows you to log OOM situations instead of just getting "Segmentation Fault" or whatever.
>>
>>61240693
that is objectively wrong
>>
File: file.png (52KB, 975x803px) Image search: [Google]
file.png
52KB, 975x803px
can /dpt/ solve this?
>>
>>61240607

Yeah, you also need to link against the library. When you're working with C and C++, there's two types of files you need to be concerned with, headers (.h and .hpp) and the actual library files (which end in either .a, .so, .dylib, .lib, or .dll, depending on the platform). You probably have some file named libtorrent.so or something similar. If it's in a standard linking directory, like /usr/lib, then all you have to do is add -ltorrent to your linker flags. Otherwise, you likewise need to extend the list of directories for your compiler/linker to search through, this time with -L instead of -I (easy to remember: -L for link, -I for include)

So let's say you have a directory structure that looks like this:

main.cpp
include/libtorrent/*.hpp
lib/libtorrent.so

You'd compile it like:

g++ main.cpp -I include -L lib -ltorrent

>>61240649

I like C and C++. I just like C++ more.
>>
>>61240738
What text editor do you use?
>>
>>61240649
Ruby has supremely shit taste.
You shouldn't take anything he says seriously.
>>
>>61240753

baka
>>
>>61240644
>>61240666
You're correct, of course. My point in bringing up printf was to illustrate what truly diligent error checking in C looks like, which is wrapping half of your function calls in a conditional to check for an error return code--or worse such as when you have to deal with code that signals errors using output parameters.
>>
>>61240750

I use Sublime Text 3 for the most part, but occasionally use Vim when I need to make quick edits in my terminal, or when I need to edit over an SSH connection.
>>
>>61240699
the kernel is like godhead pickle inspector

sometimes your program does a good

but sometimes it does a bad and it's like the crab and it goes BLEB BLEB bBLEBbb and runs off its rails

and then godhead pickle inspector picks up the crab and ponders his great creation

it's trying to fucking crab-punch his hand and it's going BLEBB BLEBBB BLUBB but it is as if tiny stone to godhead pickle inspector who has stopped it in its tracks and has it by the claw

and pickle inspector fondly regards it and smiles down at it and turns to you and whispers in his godly ethereal whisper

"segmentation fault"

and calmly, peacefully releases the crab back into the ocean
>>
>>61240738
I did -B . while in the root directory.
Do you know if there's anything like HLS but over BitTorrent?
>>
>>61240772
This one of the most reddit posts I have seen on here in quite a while.
Fuck off.
>>
>>61240819
no fuck you
>>
>>61240753
you're confusing him with the nv tripfag
>>
>>61240832
I fucking know who I'm talking about.
We have Mr shit taste ponyfucker sepples microcuck, Mrs racemixer Csharter microcuck, and some other tripfag who nobody gives a fuck about.
>>
>>61240790
Off the top of my head, I know no such protocol. Give it some good googling though.
>>
>>61240886
Why is it considered such a hard problem? There are tons of competing standards, why is that?
>>
>>61240722
Introduction to programming class?
>>
>>61240722
Does it need to be fast?
>>
File: i.gif (40KB, 500x306px) Image search: [Google]
i.gif
40KB, 500x306px
>>61240849
>racemixer
>as an insult
>>>/s/tormfront
>>
>>61239430

_builtin_clz is undefined when i = 0.

Also there are multiple _builtin_clzs. Make sure you use the right one.
>>
>>61240722
But 9009 is a valid answer for number 1 too. 9009 (3*3*7*11*13) has two factors with the length of 1. Unclear wording.
>>
>>61241100
Takes a grand total of 3 seconds to fix
#define _builtin_clz(i) (!i&&return 0;return_builtin_clz(i))
>>
>>61241021

>Why is it considered such a hard problem?
Anything networking-related is a hard problem, especially when it involves lots of clients. Bandwidth and network latency are problems that you can't just throw more money and hardware at and call it good.

>There are tons of competing standards, why is that?
Because somewhere along the line, someone looked at a standard and said, "I don't like how this does X, so I'm going to make my own standard." Alternatively, they may have thought, "There needs to be a universal way to do Y instead of so many competing standards." Point is, anyone can make their own protocol, and anyone will if they're dissatisfied enough and motivated to make their own. If enough people share that dissatisfaction, then the new protocol gains traction. But others might still use the old protocol because legacy software.

Software is doomed to reinvent the wheel and will continue to expand the need to maintain old crap that no one else is using. This isn't efficient at all, but at least it means more people will have jobs. Perhaps we may be able to avoid massive technological unemployment if we make everything dependent on software, but make everyone use a different standard to do the same thing.
>>
>>61241141
That's not valid C, idiot.
>>
>>61241157
How is it not valid C?
>>
>>61241161
>!i&&return 0;
You can't do this.
>>
>>61241161
'return' is a statement, but you're trying to use it as an expression. It's the same story with the ;. Also, you're missing a space after the second return.
Why the fuck is that a macro, and why are you putting flow control inside of a macro?
If you weren't stupid, you would write
static inline clz(unsigned n)
{
return n ? __builtin_clz(n) : 0;
}
>>
>>61241202
>static inline
'static inline unsigned' I mean.
>>
>>61241141
the point of the builtins is to be efficient, you would probably ensure that i is never zero, or you would just use __builtin_ffs instead
>>
>>61241247
or __builtin_clrsb
>>
>>61241188
>>61241202
For what purpose? Why can't it be an expression with the value of void?
>>
>>61241309
Well, it wouldn't be able to return to anything, for one thing. It's already directing the program flow to return to the calling context. If it were an expression, its value would never be needed.
For another thing, void is not a value. It's a type. In fact, it's so very much not a value that it's actually an incomplete type. A declared but undefined type that cannot BE defined, specifically so that it should be unable to hold any value.
>>
>>61240116
I agree. Common Lisp excels in this.
>>
>>61240116
>>61241369
That being said, though, when I were to use such a language, I'm still not sure if I'd choose to use stack-unwinding error handling or not.
>>
>>61241332
Yes, but a void function that exits the program can't return anything, but I can still treat it as an expression.

Yes, it's a type. But why isn't return just a void function?
>>
>>61241393
It has to do something a function can't do: restore the calling context of the function it's invoked in.
>>
File: output-file.webm (49KB, 500x300px) Image search: [Google]
output-file.webm
49KB, 500x300px
>>61241142
R-Ruby senpai, I-I made this for you in Ruby.
>>
>>61241453
But why does this mean it has to be an expression?
>>
>>61241481
Don't you mean why does it mean it can't be an expression?
In any case, what would be the point?
>>
>>61241461

Conway's Game of Life. Not bad.
>>
>>61241517
Cornwell's *
>>
File: 1374576817989.jpg (4KB, 190x190px) Image search: [Google]
1374576817989.jpg
4KB, 190x190px
>>61241461
Wow, Ruby really is slow as fuck.
How do people defend that shit?
>>
>>61241498
Yeah, why can't it be an expression.
I just don't see the point of not having it as one. It makes the language inconsistent. For example, so you can do things like that. While it may not be considered best practice, that's not up to the language to decide.
>>
>>61241522
This is a joke, right?
(Your post, not the one you're calling slow)
>>
>>61241142
But all you need to do is split it up into predictably large chunk sizes and deliver them over HTTP, i.e. issue a request to 'https://domain.com/streams/stream1/' + quality + '/' + (time-startTime(/chunkSize + '.mkv', start playing whatever comes out, as soon as the bandwidth isn't saturated issue the next
How is it such a hard problem?
>>
https://pastebin.com/R9i4bTf2
whats wrong with this guy's tic tac toe program
>>
>>61241557
>import java
that
>>
>>61241522
the output is on a timer...
>>
>>61241531
Because if it doesn't have a value, it makes precisely zero sense to use it with the && operator.
>>
>test.c:9:2: error: void value not ignored as it ought to be
at last i truly see
>>
#include<limits.h>
#include<stdio.h>
#include<stdlib.h>

int main() {
int mem = INT_MAX;
void* p;

while ((p = malloc(mem)) == NULL) {
mem--;
}

printf("Done");

}
>>
>>61241838
>Only allocating 2GB of memory
Come on, pick a bigger number.
>>
>>61241960
not portable
>>
>>61241997
Pick SIZE_MAX and stop being a pussy.
Also, yes it is.
>>
>>61241960
here we go
#include<stdio.h>
#include<stdlib.h>

int main() {
size_t mem = (size_t)-1;
void* p;

printf("Max: %zu\n", mem);
while ((p = malloc(mem)) == NULL) {
if (mem < 0) break;
mem--;
}
printf("Actual: %zu\n", mem);

}
>>
>>61242009
INT_MAX bytes being 2GB is not a portable assumption
>>
>>61242028
Yeah, yeah, whatever. It doesn't actually change my point. It's just that INT_MAX typically isn't that big of a number.
>>
>>61242013
Make it binary search for the max allocation size.
>>
>>61239343
Traps and anime are not mutually exclusive. Anime is programming related therefore traps in anime are programming related.
>>
>>61242049
#include<stdio.h>
#include<stdlib.h>

int main() {
size_t mem_upper = (size_t)-1;
size_t mem_lower = 0;

printf("Max: %zu\n", mem_upper);
while (1) {
if (mem_upper - mem_lower <= 1) break;

size_t guess = (mem_upper + mem_lower) / 2;

if (malloc(guess) == NULL) mem_upper = guess;
else mem_lower = guess;
}
printf("Actual: %zu\n", mem_lower);

}


Max: 18446744073709551615
Actual: 17179869183

17 gigs ...? I only have 8. That seems wrong.
>>
>>61242222
Linux lies about allocations. It'll return non-NULL, even when it doesn't have actual memory for the storage.
>>
>>61242222
oh god damnit, I bet mem_upper + mem_lower is overflowing
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
ωth for my Metropolis algorithm doesn't fucking work in Fortran.
>>
>>61242222
>what is swap
>>
>>61242239
>>61242222
same result even with
size_t guess = (mem_upper / 2) + (mem_lower / 2);

Should I try with calloc instead?
>>
>>61242260
Yeah. Should work out.
>>
>>61240177
the language designers believe you're too stupid for multiple inheritance so they give you a crippled version
>>
>>61240177
separates the interface from the implementation. In this case List is the interface, ArrayList is the implementation.
List<int> a = new ArrayList<>(); 
... use a ...

Then you do some profiling and realize a linked list is faster
List<int> a = new LinkedList<>(); 
.... use a ...

Then you write a super fast List implementation that's optimized for your use case
List<int> a = new MyList<>();
... use a ...

Since you coded against the interface List, you can easily swap out the implementation class without changing any other code.
>>
What's the advantage of using an actual tree structure for HeapSort as a priority queue vs just using an array?
I could see maybe at extremely large sizes you get the same advantage linked lists give you, but it feels like the heapify methods would be much more expensive using node structs vs just repeatedly swapping through a linear order with a bit of math.
>>
>>61242778
HeapSort by definition uses a heap, which is a tree structure.
>>
>>61242793
Yes but I'm referring to an actual node struct, versus using an array with level-order traversal
>>
any other image hashing algorithm?

http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
>>
>>61242778
There is no reason to use an "actual" tree when doing heap sort. It's more efficient, and probably simpler to use an array.
>>
>>61242884
Okay so my prof is just being a showoff then
Or maybe retarded
Who knows!
>>
>tfw doing text manipulation in C++
>>
>>61242923

but u have no face image anon
>>
>>61240350

yes, they have vastly different philosophy it is very important

pajeet team a focuses entirely on pooing optimisation and efficiency, they can produce a greater volume of poo, in less time, than any other team on the planet - their strategy has been optimised over years of straining and hard work

the problem with this design principle is that it neglects every other aspect of the art, sacrificing it for greater gains. pajeet team a is focused solely on a single metric to the detriment of everything else

after the fall of the british raj, new philosophies began to develop in order to promote different poo strategies. pajeet team b was established with a more intelligent focus specifically on DESIGNATION - they intend to be the answer to the question 'does producing a high poo volume really matter if its not targetted in the correct place?'

pajeet team b still works to poo efficiently, but the art is more focused on getting the most out of a specific volume of poo through optimised designation, rather than just producing as much as possible in the shortest amount of time

with a certain amount of interoperability and synergy established between both teams, we believe that we will be most successful in the pursuit of world power 2030
>>
>>61243001
tfw means "totally fucking weird"
>>
>>61243145
baka desu senpai
>>
File: 1497393716929.png (9KB, 420x420px) Image search: [Google]
1497393716929.png
9KB, 420x420px
>>61243145

i thought its 'that face when' tho
>>
>>61243212
It's that feel when
mfw is my face when
>>
>>61243242
No it's not, you fucking newfag.
>>
File: 1498969887514.jpg (110KB, 521x521px) Image search: [Google]
1498969887514.jpg
110KB, 521x521px
>>61243242

so ive been a life of lies huh
>>
>>61243259
kek
>>
>>61243242

only correct guy in this very important discussion.

do you tards really believe tfw and mfw mean exactly the same thing? they'd be completely redundant. why even bother having tfw if it means exactly the same thing.

you turboautists who are unable to communicate properly without a diagram of faces making expressions and the associated feelings have been conditioned to replicate that pattern of behaviour by ascribing an image to everything you post. you are unable to appreciate 'tfw' because you don't understand feelings, you have to refer to a chart of anime faces before you understand.

so don't you try to point out 'that' and 'my' are different words like that somehow makes a difference to the discussion. yeah i'm on to you.

tfw has only ever been that feel when, im sorry to embarrass you in front of everyone here, i know you don't like to be wrong, but that's just the way it is.
>>
I REALLY FUCKING HATE WINAPI
>>
While using c++11 should i use pthread or lpthread for multi threading? On my desktop it compiles fine with both but on my laptop only with lpthread.
What's the difference?
>>
>>61243460
What about it? I find it easy to work with, MSDN has really good documentation for just about everything, and because they never remove anything even old documentation from 20 years ago is perfectly applicable today
>>
>>61243515
After googling a bit i think that lpthread simply means link pthread, but now i don't know why -pthread worked on my desktop. Maybe gcc picked up my slack.
>>
>>61243570
YOU WANT HOOK?
HERE HOOK FOR HOOK
THAT HOOK GIVE YOU WINDOW HOOK FOR HOOK FOR HOOK THAT WINDOW HOOK NEED TO HOOK INTO WINDOW HOOK HOOK
HERE HAVE ANOTHER HOOK FUCK YOU
>>
>>61243673
Pretty clean api if you ask me. My biggest annoyance is that they make you pass the size of the struct they provide you everywhere. I can't figure out why they'd ever need that.
>>
>>61243731
Probably has something to do with backwards compatibility somehow, every weird design choice in Windows can be traced back to backwards compatibility.
>>
>>61243731
I've not worked with it very much honestly, I just remember having to build a "screenshot on mouseclick or keystroke" function into our testbed and it required such a retarded amount of unsafe calls and low-level hooks that I nearly went fucking mad
>>
>>61243778
>unsafe calls
Elaborate.
>low level hooks
I'm assuming it's a utility meant to capture all keypresses when you're not even focused on the window you own.
I think it's to expected. There's not many good options for that facility. We'll thinking about it there's a few way but I don't find them objectively better than this honestly.
>>61243773
Well what doesn't make sense is that the same effect can be achieved by them doing a sizeof of the struct they want inside their function. The value isn't (officially) allowed to be anything else. It's just so pointless.
>>
I'm learning java from a text book but feel like I'm stagnating.
It's a bit fun to program but I don't know enough to be interested in anything specific.

What do I do to progress?
>>
>>61243842
Maybe the right term is "unmanaged", but the testbed was written in C# so for me to access the hooks I needed I had to do some DLL imports and the compiler was constantly nagging me about "this shit is really dangerous please don't do it" until I could find the pragma call to shut it up.
Presumably because I was exiting the scope of the CRE to fuck around directly with windows, but regardless.
>>
>>61243731
https://blogs.msdn.microsoft.com/oldnewthing/20031212-00/?p=41523
>>
>>61243867

I faced this a lot when learning.

If you're anything like me, you're not able to tell yourself to stop using a resource until you've actually completed it; that would be failure. I'd read course books and not really enjoy them, but not be able to start anything else until I'd finished because otherwise I'd feel like I was giving up.

This is ambivalence, and it is the enemy of self study. It will kill your discipline and motivation to work, so you'll procrastinate or stop trying to learn.

The only way I found to get myself out of it was to find a resource that I really DID want to learn from -- something that was still in the same language -- and enthuse myself about the importance of using that resource. Things are easier to be excited about when you're not actually going through the hard process of doing them. Then I'd tell myself that I could only move onto the resource that I was enthusiastic about if I finished what I was currently working on.

This would reinforce the importance of what I was currently doing, and give myself a goal that I was enthusiastic about. It didn't matter that the goal was entirely artificial, and that I'd probably stagnate after a while with the new resource too, it was enough just to trick myself into looking forward to something and feeling like there was a personal reason for me to carry on learning what I was learning.

There is always a personal reason to carry on with what you're learning, of course, because even if you're doing something pretty banal, if its programming, you're training yourself more and more. At the time its impossible to feel that way though, even if you know its true, so I find that setting these artificial goals that I can get excited about gives me a progression mechanic that I can feel good about.

Feeling good about eventually being good at programming is hard if you're learning, because it takes so long to actually be good enough to be able to do something that's REALLY worthwhile .
>>
There's a lot of guard clauses in C# these days. Are they trying to become a functional language, or just following in C++'s footsteps?
>>
>>61244156
I haven't seen many, unless you count throws.
>>
Should I use SignalR or the default .NET websockets implementation for my 3d loli mmorpg?
>>
File: 1374574508775.jpg (29KB, 499x500px) Image search: [Google]
1374574508775.jpg
29KB, 499x500px
>>61244176
>Microsoft garbage
>>
>>61244213
>being this much of an avatarfagging sissy cocksucker
>>
>>61244215
>A single reaction image of a character showing displeasure
>Avatarfagging
I don't think that means what you think it does, pajeet.
>>
>>61244219
>taking what I say literally & seriously
are westerners autistic in general?
>>
>>61244176
>signalr
yagni.
use the websockets libraries in .net core.
>>
>>61244238
yeah, thats what i was planning to but I wanted to check in first, thanks
>>
What does Python intern exactly?

Is it any object with the same type and value?

I'm getting strange results when I'm using a function to generate pseudorandom sequences; the same sequence keeps appearing multiple times in a row despite a very low probability.

I probably fucked up my code, but I can't immediately see the problem. It can't be interning or caching the result of my function or something behind the scenes, right?
>>
I was doing SICP recently, but... Isn't teaching black box design philosophy right away a huge mistake for an introductory course?

It seems like to less responsible students it'd send the message "It's OK if your program is an undebuggable mess of shit when you open up the hood so long as co-worker Joe can get his job done with it." And I don't think they really go into debugging strategy at all in the course.

Those professors were probably more qualified to make such a decision than I am but it's hard for me to understand the choice to emphasize the idea early on. I guess it's assumed people taking the course are not actually all that new to programming.
>>
>>61242222
>what are virtual addresses
>>
>>61244684
Well, first off, have you confirmed programmatically that it is indeed having a tendency towards some sequence? Otherwise it could just be your perception, and such a thing should be easy to do.

If you look at the Python docs it's stated that the RNG in the random module is suitable for most purposes but not for all, and not crypto-safe.

"Warning

The pseudo-random generators of this module should not be used for security purposes. Use os.urandom() or SystemRandom if you require a cryptographically secure pseudo-random number generator. "
from https://docs.python.org/3.6/library/random.html

You could try using the other random functions mentioned there(os.urandom(),etc) if you're not getting the results you want.

Also there are module librar(ies) dedicated to noise and such. Like you might try the noise module you can find in
http://www.lfd.uci.edu/~gohlke/pythonlibs/

Good luck, anyway.
>>
Does anyone have any advice on what program to build in order to learn C++? I know Java, have done some recursive stuff, and have scripted a number of things in C++, but I barely understand classes/etc.
>>
>>61244933
>I know Java ... but I barely understand classes/etc.
>>
>>61244957

Sorry, I don't "know" Java, I have done some very basic stuff. I meant I know syntax, looping, some stuff about run-time. My English isn't very good.
>>
>>61245011
Build something with Java first, it will be much easier.
>>
Thoughts on Nim?
>>
>>61245033

>Compare that to, say, Java where (if I understand correctly) even basic types such as int are considered objects to be garbage collected
I'm going to take the rest of this post with a pinch of salt.
>>
>>61245029

Ok well I've been tasked to learn C++ over the summer, it will be applicable to my job. I'll start with Java though!

Suggestions? I've already done a bunch of things that find optimal paths through graphs/maps.
>>
>>61245076
What kind of a job is it?
>>
>>61240166
>There is a C library that can provide a GC to any language that needs it.
So you're telling you'd rather have a foreign language do something your language could do natively and cleanly?
>Having no runtime overhead doesn't ruin portability at all
Portable zero overhead abstractions do no exist because you are abstracting how your architecture works. See how even LLVM needs the compiler rt libraries on some systems yet the retards will spout how some languages built on top of it provide "zero-cost abstractions". This is only true for some architectures.
>If a symbol has no owner, then logically it can't be used
That's just wrong, see how OS work where plenty of resources are not "owned" yet need to have an arbitrary lifetime.
So none of your points stand.
>>
>>61245091

It's a mechatronics lab at my school. I just graduated mechanical engineering but am basically being converted to an electrical engineer. Trouble is I don't have any gizmos over the summer other than my laptop. Should have bought an arduino or something...
>>
Can you pretty much ignore exception handling if you're not developing enterprise software? I mean, obviously you'd probably want to recover from certain trivial exceptions that are... non-exceptional, like being unable to open a user-specified file, but other than that I don't really see the point if it's not a PROGRAM THAT ABSOLUTELY CAN NEVER STOP RUNNING UNDER ANY CIRCUMSTANCES type of deal. Of course, hopefully your program isn't throwing exceptions right and left in the first place...
>>
OOP makes more sense than FP as a way to express relationships between entities in vidya
ECS paradigm is trash, literally just use OOP, entity = object, component = trait, it's much clearer and more expressive that way
Fite me
>>
>>61245216
>vidya

Literally who cares.

Also, if you think about the game in terms of game state being passed from one frame to the next, functional programming makes plenty of sense.
>>
>>61245128
>Portable zero overhead abstractions do no exist
Sure they do, they're called macros. Exclusively compile-time overhead is close enough to zero overhead for my blood.
>>
Tomorrow I have a quiz on CS questions like what's polymorphism, what's a class, what's floating-point, etc

ask me stuff pls
>>
>>61245257
what's polymorphism, what's a class, what's floating-point?
>>
>>61239643
I'm *kinda* working on that, but who knows how far I'll get
>>
>>61245201
Just do what Microsoft does. Wrap your entire program in a single try-catch and if anything throws then show a useless message like "something happened =(" and crash.
>>
>>61245235
Why not both? A language doesn't have to be exclusively OOP or functional, see Ruby.
>>
>>61245300
Make sure you have C style syntax with proper { } instead of whitespace sensitive trash
>>
>>61245235
>Literally who cares.
Vidya is an untapped art form.
>Also, if you think about the game in terms of game state being passed from one frame to the next, functional programming makes plenty of sense.
Sure, for the systems. But even in a functional approach, the entities need to be represented with ADTs with dedicated constructors, access functions, and manipulation procedures (which may, in a stateless language, just be transformative copy constructors) and the components by record composition, so you're basically doing OOP anyway, just without an easy syntax for it. Unless you actually use data oriented ECS where entities are just integers and components are table entries, which is the epitome of autism.
>>
>>61245180

Write a text-based game?
>>
>>61245308
Languages are languages. Paradigms are paradigms. A language can include a feature to make it easier to work in a given paradigm, but nothing stops you from writing object-oriented C code or functional Java.

Mixing paradigms is probably a bad idea, though, unless you're being very selective about how you go about it. You should also ask yourself what problem you're solving by doing so that couldn't be solved better by sticking to a single paradigm.
>>
>>61245266
Polymorphism is a feature that allows one name to refer to multiple blocks of functionality. For example, ad-hoc polymorphism refers to overloading a function name based on the number or type of parameters, and OOP polymorphism is sometimes used to refer to instances where a subclass object can be passed as an argument to a function that expects an instance of its superclass but still call the appropriate methods

A class is a blueprint for objects; it encapsulates functionality such as data (member variables) and functionality (member functions/methods) and often allows extensibility through inheritance

A floating-point number is a rational number that uses a decimal point and it is often used as an approximation of real non-rational numbers. I need to revise how they are represented in memory cause I forgot but iirc it's very similar to signed integers but with an indication of where the decimal point is situated. Maybe using a double and having the first half represent the number before the decimal point and the latter half the number after the decimal point
>>
>>61245257
FP:
What's floating point and how it is different from integer arithmetic?
What's the most implemented floating point standard today?
How does the aforementioned standard represents numbers? What's the difference between various storage sizes?
What kind of numerical issues can happen when dealing with fp numbers? Describe a way to check for equality between 2 fp numbers.
>>
>>61245322
>using features of functional programming is basically OOP anyways

Just stop. You seem to have a very shallow understanding of what separates function from OO.
>>
>>61245391
What separates functional from OOP?
>>
This is very interesting. How come C++ (and other big boys) get absolutely blown the fuck out by a language that hasn't even been released yet?

proc fibonacci(n: int): float =
if n < 2:
result = float(n)
else:
result = fibonacci(n-1) + fibonacci(n-2)

echo fibonacci(50)

Nim takes 5.6s


#include <iostream>

using namespace std;

float fib(int x) {
if (x < 2)
return float(x);
else
return fib(x-1)+fib(x-2);
}


int main() {
cout << fib(50) << endl;
}

C++ takes 39.9s

>inb4 the algorithm is shit
It's exactly (almost) the same in the two examples
>>
>>61245391
It is though. An ADT is literally just a class whose methods are free instead of being stored in a vtable and which doesn't support inheritance.
>>
i have a cock ring in my luggage >>61245402
>>
>>61245308
Ruby is smalltalk based and is about as OOP as OOPs can be.

Just because there's map and fold in the standard library doesn't make something functional.

Functions aren't even first-class in Ruby.
>>
>>61245339
You clearly have never used the patrician language Ruby.

>>61245449
>What are code blocks
>>
>>61244714
You're speaking like a computer nigger.
The purpose of SICP isn't to teach people how to work on ENTERPRISE scale projects effectively (according to some bullshit management philosophy)

it's to foster a sense for the fundamentals of abstraction
>>
test
>>
>>61245516
test
>>
What the fuck is going on with /g/
>>
>>61245357
I'm answering this as I'm reading about it cause I'm pretty shit at FP

>What's floating point and how it is different from integer arithmetic?
Floating point refers to the decimal point, it is floating in the sense that the exponent decides where the point is on a case-by-case basis. One of the main difference between floating point arithmetic and integer arithmetic is in terms of precision: floating point arithmetic often results in an approximated result.

>What's the most implemented floating point standard today?
IEEE 754-2008 Standard

>How does the aforementioned standard represents numbers? What's the difference between various storage sizes?

It uses 3 chunks: a 1-bit sign chunk, and, depending on the precision used, variable sized chunks for the biased exponent and for the fraction/mantissa. The number of bits used to represent the mantissa is larger than the number of bits used for the exponent


>What kind of numerical issues can happen when dealing with fp numbers? Describe a way to check for equality between 2 fp numbers.
Some numbers cannot be represented in a finite decimal representation (e.g. 0.1 or 1/3) so doing encoding and arithmetics may result in loss of precision. To check for equality I would check if the difference of 2 FP numbers is lower than a specified threshold e.g. abs(a-b) <= 1e-08
>>
File: Screenshot_2017-07-06_20-25-26.png (111KB, 883x722px) Image search: [Google]
Screenshot_2017-07-06_20-25-26.png
111KB, 883x722px
>>61239343
>What are you working on, /g/?
Virtual DOM frontend framework in Web Assembly. I'm building it up, as I port a JS-heavy project to WASM. So far it render the initial DOM and diff for updates.
>>
Looking to the name of every input name on page

var list = jQuery( "input[name^='qty']" ).map(function(){

return jQuery(this).val();
}).get();


No luck
>>
Hello?
>>
>>61245432
Your shit's all retarded.
An ADT is not an object unless it features inheritance, dynamic dispatch (polymorphism), and encapsulation.
>>
File: 1467953276532.png (79KB, 618x624px) Image search: [Google]
1467953276532.png
79KB, 618x624px
I'm making a JS script that displays a grid with each of its lines and columns made from n*n sized squares.
They're contained within a <div> tag which always stays the same size (window.innerHeight), so only the size of the squares changes.

I've accounted for the 1px border size on the CSS so I've subtracted 2px from the squares' size and width in the for loop.
Yet the script still doesn't work when I input certain numbers, such as 31 (I get extra squares on the bottom of the page and have to scroll down).

Could I get some help?
>>
d-does gpa matter guys?
studying CS and got more C than I thought I would. As long as I pass its fine right?
>>
>>61245635
what if it falls down in a forest and nobody is around to hear it?
>>
What's the binary representation of 4 5/8?
>>
>>61245643
>n*n sized squares.
That was a mistake on my part, sorry. I meant
>each of its lines and columns made with n squares with n being user input
>>
>>61245653
if gpa.includes() = "C" {

wave(){

bye,bye to Big 4 }
}


}
>>
 x: int = 1; 
>>
>>61245653
Nobody gives a fuck about your GPA once you've got a couple years of good experience under your belt. Make sure you do internships during college, don't ever have an empty summer.
>>
>>61244714

That's just a cancerous mindset

> Gee I don't know if I should be doing this guys, it might corrupt my little brain to not follow the Pajeet handbook and the boss might get angry and fuck my wife again
>>
>>61245729
>t. another low gpa brainlet
>>
>>61239491
>>61239519

yeah and I fucking told you that yesterday you swine
>>
>>61245564
gookmoot is chinking us on server uptime
>>
>>61245727
>var x: Int
why are POOlangs these days doing this shit?
>>
>>61245671
however you want
>>
>>61245760
>t. another unemployed straight A student
grades are great and all, but I know too many students who graduated with great grades, and no actual experience. Their resumes went straight to the bin.

>>61245786
I think they do it for type inferencing
>>
>>61245788
what's your favourite?
>>
>>61245803

Type inference is great and all, but you can have type inference without butchering explicit type specifications.
>>
>>61245823
They don't want you to do explicit type specification.
>>
this guy at white castle asked for my autograph so i signed it "dear dave, thanks for the support, asshole"
>>
where do I start if I want to learn C?
>>
>>61245844

Assembly
>>
>>61245844
C Programming: A Modern Approach
>>
>>61245830
Fuck them. If they have it in their lang, it better be usable. Making something unwieldy for the exclusive sake of making the alternatives look better is cancerous.
>>
I'm a shitter. I started with python, then fell in love with lua. I write games in love2d and shit. The problem is that it's too comfy. I've tried to learn a real programming language like c or c++, but what I could do in just a few lines now becomes a marathon. Should I endure or keep being a scriptfag for the rest of my life?
>>
>>61245871
mix the two
>>
>>61245788
according to IEEE
>>
Best IDE for someone learning python?
>>
>>61245822
4 + 5/8
= (4*8 + 5) /8
= 37 / 8

(37, 8)
(100101, 1000)
>>
>>61245866
Just because it's a bit different than C++ or C or Java or whatever you're coming from doesn't mean it's bad.

>>61245871
If you don't need to use the "real" programming languages for your use-case, don't. C and C++ have specific use cases, and you're not hitting them.
>>
>>61245725
who cares about big 4 if other companies pay the same amount of money
>>
>>61245904
A text editor. You shouldn't use an IDE when you're learning a language
>>
>>61245858
looks expensive. how is it different to C Programming Language 2nd Edition?
>implying I won't pirate
>>
>>61245904
linux + vim
>>
File: Capture.jpg (10KB, 213x78px) Image search: [Google]
Capture.jpg
10KB, 213x78px
is codewars /dpt/ approved?
>>
>>61245929
There's no reason not to start with K&R C Programming Language. Any other work is supplementary, and probably a waste of time.
>>
>>61245926
What's a good text editor for programming, then?
>>
>>61245940
No, it looks stupid and gay. Also you forgot to turn off your tripcode.
>>
>>61245405
C, C++, Java, C# and others don't have support for tail recursion. The languages that do are much faster in recursive calls because they don't have to put each new function call on the heap.
>>
>>61245940
that's the worst one. do leetcode
>>
>>61245992
>C, C++, Java, C# and others don't have support for tail recursion.
Java and C# might be limited because of bytecode, but isn't C and C++ implementation-defined in that regard?
>>
>>61245908
You are right. I'm a hobbyist programmer for now, but maybe it could become my job, so I'll have to learn c/java/whatever is industry standard someday.
I'll look up what >>61245882 said and see if it works.
Thanks /g/entlemen.
>>
do you use emojis on your code?
>>
>>61246076
Write your programs in Lua or Python or whatever, and when you find that performance is becoming an issue, rewrite the hotspots in C.

If you want to learn C or Java just for fun, go ahead and do that, but you gotta realize there's a reason languages like Lua and Python are used.
>>
>>61245940
Any of them will accomplish the same thing. Nothing.

Code wars is for Indians. No racism, it's just that they need to prove their competence somehow and they can't afford to have interviews for such temporary positions. The turnover rate there wouldn't allow it.
That's why if you look at the scores overall on those sites you usually find a fair amount of Indians.
(go to https://www.hackerrank.com/leaderboard?level=3 for instance and check it out. Almost no Indians in o(1), droves in o(n))
This stuff is fun to look at too:
https://blog.hackerrank.com/which-country-would-win-in-the-programming-olympics/

It's not very useful for anyone. But if you like it as a game you can go ahead of course.
>>
File: 1499217368737.gif (253KB, 500x281px) Image search: [Google]
1499217368737.gif
253KB, 500x281px
Uhh, are we going to need a new bread?
>>
>>61246202
Not yet
>>
>>61245405
>taking more than 1 ms to calculate fib(50)
Your hipster language is not doing really better actually. Maybe it does some parallelization tricks on the call stack, but it didn't transform the function into tail-recursive form, so it still performs poorly.
>>
>>61246251
Yeah, you're right. Not sure why I though 300 was the limit.
>>
File: 1499346638030.png (105KB, 698x1615px) Image search: [Google]
1499346638030.png
105KB, 698x1615px
Why Unicode?
>>
>>61246471
Because that's scientific, you bigot. >>>/pol/
>>
>>61246471
>transgender and intersex is the same
>what the fuck are the others?
>>
File: demo.gif (4MB, 854x480px) Image search: [Google]
demo.gif
4MB, 854x480px
Why is programming this much fun? I just started learning the basics of Javascript this week and boy it's fun. I know it's going to require a ton of work but maybe it will turn into a career.

>What are you working on, /g/?

A tiling script for KDE.
>>
File: panic.jpg (54KB, 240x284px) Image search: [Google]
panic.jpg
54KB, 240x284px
>>61246471
>neuter
>>
>>61246505
What dock are you using?
>>
>>61246505
did you make a wm in js? what's a "tiling script" and kde is a DE not a wm
>>
New thread:
>>61246538
>>61246538
>>61246538
>>
>>61246536
Tiling script for KWin, to be exact. People just recognize KDE better than KWin. KWin has a Javascript scripting engine. So a KWin script is basically js code on top of the wm, responding to signals of windows opening, closing, moving etc.


>>61246534
Latte
>>
>>61245643
>>61245677
Anyone?
>>
>>61245725
>Wanting to work at the Big 4 to begin with
Yes I'd love to spend 80 hours a week at work dealing with gigantic codebases that are irreparable for all the intern and pajeets
Thread posts: 315
Thread images: 35


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