[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 148 KB, 600x664, 1507124332930.jpg [View same] [iqdb] [saucenao] [google] [report]
63442124 No.63442124 [Reply] [Original] [archived.moe] [rbt]

prev: >>63436461

What are you working on, /g/?

>> No.63442133

Trying to program myself a girlfriend

>> No.63442143
File: 320 KB, 1354x517, Screenshot from 2017-11-19 15-41-44.png [View same] [iqdb] [saucenao] [google] [report]

Is it possible to average two numbers in C?

>> No.63442149

You may be pleasantly surprised with what I cook up.

>> No.63442157

If there is, it's probably not with stdio

>> No.63442166
File: 1.40 MB, 406x449, 2spoopy.gif [View same] [iqdb] [saucenao] [google] [report]


>> No.63442182

I hate eliza, never has her own opinions just kind of repeats what I say and asks weird vague questions.

>> No.63442191

>(e ~: t) means e has type t

Why the difference from the regular e : t

>> No.63442192

Nope. That's a new concept only invented in the last year or so.

>> No.63442204

Which lisp did Lain use?

>> No.63442211

python is faster than perl... I cant believe it

>> No.63442241

and yet it's still shit.

>> No.63442254


>> No.63442304 [DELETED] 

Does HRT make you a better programmer?

>> No.63442337

I'm new to programming and kinda want to get into the it / server admin world. Anyone recommend languages to learn for that? I've heard c# but I have no idea

>> No.63442349

You'll want bash/powershell.

>> No.63442353 [DELETED] 


>> No.63442381

too late bro, these days server admins are the people who were installing gnu/linux as toddlers

>> No.63442409

Define "number" here.

>> No.63442419

a quantity or amount.

>> No.63442432

Be more specific. The name of a set of numbers is fine.

>> No.63442455


>> No.63442484
File: 1.28 MB, 1920x1080, 1507089761622.png [View same] [iqdb] [saucenao] [google] [report]

>It's another average autist episode

>> No.63442487

within the natural numbers it is not necessarily true that there is a natural number solution to averaging

would rational results be allowed?

>> No.63442500

>it / server admin
reconsider this. they don't do programming.

>> No.63442501

No computer or programming language can truly average two arbitrary rational numbers.
It would require a computer with potentially infinite memory.

>> No.63442512
File: 134 KB, 923x1163, Screenshot_2017-07-08_00-10-31.png [View same] [iqdb] [saucenao] [google] [report]

Bash is faster than Python.

>> No.63442517

>rational numbers
Natural numbers*
I read rational in the other post, and ended up writing that instead.

>> No.63442525

Lucky for you that ℕ isn't Q.

>> No.63442571

You could be dealing with numbers so large, they couldn't fit into memory. If you add more memory, I'll just throw a bigger number at it.
The algorithm obviously exists, but you can't execute something over an infinite set in the reality.

I'm only really bringing this up because I'm trying to pre-empt any equally autistic replies about "but your solution only works with N-bit numbers, what if I want to use N+1-bit numbers?".

>> No.63442584

Just post your fucking code already.

>> No.63442590

But it's the job of a compiler, not the language. Post your code.

>> No.63442622
File: 60 KB, 602x960, 19601547.jpg [View same] [iqdb] [saucenao] [google] [report]

What is Reflection?

>> No.63442687

I'll just post my arbitrary number of integer averaging function.
int iavg(int n, const int arr[static const n])
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;

// error + loss <= -n
} else if (error < 0 && loss < 0 && error <= -n - loss) {
// error = (error + loss) + n
error += n + loss;

} else {
error += loss;

// Fix some overcompensation for error

if (avg < 0 && error > 0)
else if (avg > 0 && error < 0)

return avg;

>> No.63442701

This was for natural numbers, not integers retard.

>> No.63442707

Natural numbers are a subset of integers, idiot.

>> No.63442718

It doesn't average two numbers, because the second argument is not a number.

>> No.63442721

Doesn't matter, nobody asked for your faggy negative numbers. Your average is gay.

>> No.63442730

working on this stupid cuck website but im getting paid a shit ton for it so i dont really give a fuck. just knocked out like 10 features with the other dude so our prototype shit is mostly done i guess.

>> No.63442750

Is this the power of C?

>> No.63442767

Yeah but with repeated /dpt/ shitposting added to it.

>> No.63442779

Yet you still failed to produce a function that actually averages two numbers, even within our arbitrary confinement.

>> No.63442793

Because that's impossible to achieve in C.

>> No.63442799

Can't be done, lad.

>> No.63442842

I have to admit, the cat is pretty fucking cute. Thanks for showing me.

>> No.63442851

It's the power of working in modular arithmetic.

I wrote that function ages ago to shut up all of the stupid averaging maymays on here.
It can average any number of integers, so shut the hell up.

>> No.63442860

Post that function

>> No.63442873

you shouldn't use it normal circumstances. it's a way to find methods, fields etc at runtime. for example on android you might use it to detect if a hidden API is present on the device your app is running on.

>> No.63442885

I already did: >>63442687

>> No.63442894


>> No.63442931

rate the program laddies
double avg(T)(in T[] a)
import std.numeric: FPTemporary;

if (a.length == 0) return 0;
FPTemporary!double res = 0;
foreach (e; a) res += e;
return res / a.length;

void main()
import std.stdio: writeln;
[562, 6662, 11, -34187.564, -5].avg.writeln;

>> No.63442936

Are you stupid?

>> No.63442947

Is it too hard for you to follow instructions?

>> No.63442953

>foreach (e; a)
niceu, what language is this?
>res += e
you are already dead

>> No.63442954

>average of nothing is 0

>> No.63442975

no bully

>> No.63442994

>you are already dead
Please explain. Is this some kind of FP problem?

>> No.63443006

>foreach (e; a)

>> No.63443060

novice programmer here, what kind of program would be good to build to work on concurrency

i can only think of trivial cases

>> No.63443062

Is this confusing?
function remove_nonmatching_words(words, guess, correct)
return filter(function(word) return Multiset(map(table.unpack..operator.sub, zip(word:byte(), guess:byte())))[0] == correct end, words)

Note, I've implemented all the functions as you would assume. The '..' syntax between the function references is my syntax for composition. I've gone through the trouble of implementing that for every function in the environment on load. I think I'm going a little too far down the rabbit hole with this...

>> No.63443065

but why

>> No.63443068

the funny thing is that the most elegant solution (of averaging two ints without casting to a more precise type) seems to have been forgotten

>> No.63443107

You're a failure as a human being.

>> No.63443113

Why's that?

>> No.63443125

Necrophilia is disgusting.

>> No.63443128

solve the halting problem

>> No.63443133

Pony already did.

>> No.63443137

God C syntax is such doodycaca

>> No.63443154

It's not unreadable but it's not really elegant either.

>> No.63443182

Maybe I should do it all in reading order? And fuck the whole character arithmetic bit.

function remove_nonmatching_words(words, guess, correct)
return words:filter(function(word) zip(word:byte(), guess:byte()):filter(table.unpack..operator.eq):len() == correct end)

>> No.63443198

>function nonMatchingWords(words, guess, correct)
return words:filter(function(word) zip(word:byte()
, guess:byte()):filter(table.unpack..operator.eq)
:len() == correct end)

>> No.63443215

>Java Enterprise Ready®

>> No.63443233

I don't know the language, i just like conforming things to my personal tastes.
function nonMatchingWords(words, guess, correct)
return words:filter(function(word)
, guess:byte()) : filter(table.unpack..operator.eq)
: len() == correct end)


>> No.63443261
File: 419 KB, 439x639, ayase2.png [View same] [iqdb] [saucenao] [google] [report]

She's seen using Common Lisp.
>The HandiNAVI programming language, as seen on the seventh episode, is a dialect of Lisp. Notice that the Newton also used a Lisp dialect (NewtonScript). The program being typed by Lain can be found in the CMU AI repository;[27] it is a simple implementation of Conway's Game of Life in Common Lisp.

Here's the program.

Subete ga F ni Naru also has some Lisp code in the OP.

>> No.63443278

It's the fact that you're squeezing everything together into 1 line. Everything just looks clobbered together.

Even adding whitespace, I don't even see how to make it look not shit. Syntax just sucks.

>> No.63443301

Well if that's the case, separate it logically.
function nonMatchingWords(words, guess, correct)
return words:filter(function(word) -- filter out certain words
zip(word:byte(), guess:byte()) -- do character-wise comparison of guess and each word
: filter(table.unpack..operator.eq) -- remove any characters (in the same pos) that aren't equal
: len() == correct -- count how many characters remain, if this is equal to the correct number of characters
end) -- then the word is a possibility of a match and return it

>> No.63443308

fucken shitty-ass quick reply editor

>> No.63443321

yeah that does look better having all the lines almost equal length.

>> No.63443388

I do prefer the "data:operation(params)" syntax, it's more readable IMO. BUt now I have to go back and redo much of my environment. I'll have to make an iterator interface and define map, filter, etc. on them. And yes, before you ask, all that is possible in Lua.

>> No.63443426

What do programmers mean by "sanity check"?

>> No.63443444

just a broad term for casual unit testing

>> No.63443454

Affirm what you've been assuming and log an error/crash if you've been adsuming wrong

>> No.63443461
File: 38 KB, 1627x879, Untitled.png [View same] [iqdb] [saucenao] [google] [report]

I need help understanding how to write a pyramid like mario (mario.c)

I know how to make the white spaces push the pyramid to the right but don't understand why my code doesnt work (pic related)

>> No.63443502

It's a very catch-all term that can be applied to many things, basically just saying "does ____ make sense on a very surface level."

A sanity check on an algorithm might be a simple "input X and see if it gets the expected result on Y."

Or a sanity check can be done on data, for example if you're running a database and it stores the time something happen, a sanity check might check if that any of those times are in the future or before the database was made.

Or you can do sanity checks on parameters. For example, if you have an algorithm which uses an index of the array as a parameter, you could do a sanity check to make sure it's in between 0 and the size of the array - 1, throwing an error/returning a trivial response if it's not.

A very broad term.

>> No.63443503

>Wrote internal framework to support multi platform development for certain types of devices
>other people in the company use it
>great results

Best feeling

>> No.63443511

No more CS50 for you

>> No.63443526

Okay ?

>> No.63443625

learn for loops

>> No.63443665

It's easier to do if you just remove the repeating char loop from your outer loop. Then all that's left is figuring out how many spaces and how many *.

void put(char ch, size_t n)
while (n --> 0)

int main()
size_t max = 5;

for (size_t n = 1; n <= max; n++) {
put(' ', max - n);
put('*', n*2 - 1);

return 0;

>> No.63443677

nice spoonfeeding
she still won't have sex with you

>> No.63443682

this works for me desu
#include <stdio.h>

#define HEIGHT 5

int main(int argc, char *argv[]) {
int i, j;
for(i=0; i<HEIGHT; i++) {
for(j=HEIGHT-i-1;j>0;j--) putchar(' ');
for(j=i;j>0;j--) putchar('#');
return 0;

>> No.63443699

Don't care that I'm doing his homework, struggling with that mess of loops is not a learning experience anyway.

>> No.63443759

In fact, it might be better for somebody to show him. Otherwise he'll probably end up writing code that looks like >>63443682

>> No.63443785

it's such a stupid question though, probably just copied someone else's code with no concept of how a for loop works, even a day 1 student should be able to figure it out

>> No.63443795

Absolutely nothing wrong with that code you first-year cs nu-male cia nigger.

>> No.63443916
File: 1.15 MB, 1532x798, Screen Shot 2017-11-18 at 11.57.24 PM.png [View same] [iqdb] [saucenao] [google] [report]

Working on remote data acquisition software for pic related. Also shitty texting app that you can spam people with.

>> No.63443928

Is that a raygun?

>> No.63443992
File: 916 KB, 1280x720, particle_detector.jpg [View same] [iqdb] [saucenao] [google] [report]

Close, its a part of the particle accelerator at fermilab. Using it to test particle detectors, pic related

>> No.63444086
File: 83 KB, 600x600, 1501267413388.png [View same] [iqdb] [saucenao] [google] [report]

This might be a retarded question but I honestly am stuck and am a beginner. Python 3.

Trying to code a function that basically takes as input a 2d list.

I want to make a while loop that keeps on asking the user to input an integer.

If they do not input an integer, I want the program to tell them they didnt enter an integer and to retry (i.e. enter an integer once more).

If they do enter an integer, I want to traverse my 2d list and see whether that integer exists (the 2d list is a list of tuples where the first value is an integer and the 2nd is a list of strings like so [ (1,[ 'xd']), (2,['lol']) ] and if it does exist, I want to return that integer.

How would I go about doing this? I've tried several things that seemed to have worked for other stuff in the past but they just didnt work this time.

>> No.63444098

This is one thing I tried but it just didn't work:

choice=input("enter an integer: ")
while type(choice) != int:
print("incorrect try again")
choice=input("enter an integer: ")

>> No.63444112
File: 316 KB, 1280x720, gadfly-demo.png [View same] [iqdb] [saucenao] [google] [report]


Julia is suddenly getting lots of Stack Overflow questions now, more than Clojure, Lua, or F#, and not far below Rust.

I'm surprised, the language still hasn't reached 1.0 yet?

>> No.63444123

int(choice), it will throw an exception if it can't parse choice as an integer.

>> No.63444137
File: 4 KB, 440x84, bs.png [View same] [iqdb] [saucenao] [google] [report]

see the problem is even if i input an integer when I run the program, it keeps asking the darn question

>> No.63444156

def fn(L, N):
next( i for i in L if i[0] == N )
except StopIteration:
return False
return True

list = [ (1, 'a'), (2, 'b'), (4, 'd') ]

fn( list, 2 )
=> True
fn( list, 3 )
=> False
fn( list, 4 )
=> True

>> No.63444179
File: 1.03 MB, 1920x1080, 1510954288218.webm [View same] [iqdb] [saucenao] [google] [report]


>> No.63444185

I appreciate it but this is a bit advanced for the stage I am at right now.

>> No.63444212

Ma dud, all input in python is at first a string so you would be comparing a number(that is a string) to an intiger to see if they are the same type(which they aren't).

>> No.63444213

def input_int(prompt):
val = int(input(prompt))
except ValueError:
return input_int(prompt)

return val

choice = input_int("enter an integer: ")

>> No.63444225

import find_in_2d_list
find_in_2d_list.run([(1, 'a), (2,'b'), (3,'c')], 2)
=> true

>> No.63444238

type("3") == str
input returns strings in Python 3.

>> No.63444267

use assert

>> No.63444290

This worked, thanks, going to read up on try and except

I didn't know that, I figured if I could just make sure that my input is of class int then the rest of the function continues.

>> No.63444313

Lots of them look like they are from people doing really nontrivial stuff with it too. I saw at least one related to low level GPU stuff, another one related to interfacing with some godawful C++ template library, and then quite a few related to ML or data analysis stuff.

>> No.63444440

>You could be dealing with numbers so large, they couldn't fit into memory. If you add more memory, I'll just throw a bigger number at it.
>t. a fucking brainlet
The guy asked if it's possible to average two numbers in C. C, as a programming language, isn't tied to a physical machine, and does not reflect memory constraints. You can write a program to average any two integers, no matter how large, using arbitrary precision arithmetic.

>> No.63444441
File: 179 KB, 455x569, 1508191064708.jpg [View same] [iqdb] [saucenao] [google] [report]

actually, wasn't able to use this but now that I learned about it and understand the logic behind try/except I was able to solve my problem, thanks!

>> No.63444464

Does anyone else see a similarity in duck-debugging and therapy?

>> No.63444484
File: 32 KB, 447x456, 1509882313575.jpg [View same] [iqdb] [saucenao] [google] [report]

why is installing tk GUI so fucking hard for ruby?

>> No.63444514

What is that even, anon?

>> No.63444534

That thing where if you explain the problem, either by talking to yourself or to a "rubber duck", it will help you come up with a solution to the problem, or more easily visualize the issue you're dealing with.

>> No.63444574

>That thing where if you explain the problem, either by talking to yourself or to a "rubber duck", it will help you come up with a solution to the problem, or more easily visualize the issue you're dealing with.
Sounds like the mentally challenged version of acknowledging and examining your implicit assumptions, but whatever works for you, anon. I bet the rubber duck is proud.

>> No.63444590
File: 120 KB, 601x605, 1491876009895.png [View same] [iqdb] [saucenao] [google] [report]

Is /dpt/ full of liars ?

>> No.63444657

They're probably talking about industry code monkeys who have spent most of their career programming in trash like C++ or even Java 6, so of course they think C# is amazing. /dpt/ is full of useless NEETs with enough time on their hands to play with dozens of different languages, so perhaps counter-intuitively, they have a better perspective on where C# stands. Curlybrace shitlangs are an evolutionary dead end.

>> No.63444748
File: 122 KB, 1280x1073, 1506288359596.jpg [View same] [iqdb] [saucenao] [google] [report]

>one day I will have to work with people like this

>> No.63444754

The only jobs in my city are web development (despite removing it from the search) and applications development in C# or java. It hurts.

>> No.63444800

That's a less elegant way to put it but yes, it's more or less an exercise to help you get into such a pattern for those that struggle with it initially.

>> No.63444878

C# is shit, fucking stupid normies

>> No.63444923
File: 56 KB, 1276x720, 1510961375443.jpg [View same] [iqdb] [saucenao] [google] [report]

Only +12 lines of pull request that I should have made ages ago.

>> No.63444943
File: 127 KB, 974x714, Screenshot from 2017-11-19 21-06-40.png [View same] [iqdb] [saucenao] [google] [report]

Oh and pretty sure he's trolling.

>> No.63444995


Fact: used languages are disliked.

Likes/dislikes are pretty much on a meme basis. I don't know if you saw the SO poll this past year, but the most 'exciting' language ended up being Rust, and I guarantee that only an nth of an nth of a percent of those people even ended up learning the language.

There's no *particular* reason for people to like it. It's not terribly interesting, and it's got abysmal syntax, but it's Mozzarella's 'hot new' thing, and I suppose people have heard about the FF rewrite being undertaken with it.

>> No.63445017

>Fact: used languages are disliked.
Looks like perl and delphi is used way more than C.

> I guarantee that only an nth of an nth of a percent of those people even ended up learning the language.
I'm intrigued. Lay down your proof. Rust growing, almost as fast as go.

>> No.63445063
File: 4 KB, 694x448, 1340169111348.png [View same] [iqdb] [saucenao] [google] [report]

>tfw you work with a programmer that writes spaghetti code which likes to break and leak memory

>> No.63445079

>Likes/dislikes are pretty much on a meme basis
>it's Mozzarella's 'hot new' thing
It's not even that. The only people who care about Rust at all are part of a cult following. I think Rust is trash, but I just don't care enough to go and "downvote" it somewhere. Rustlets, on the other hand, are very passionate about shilling for it in every way they can, and so you get the result that a language that nobody uses besides a small SJW cult is highly "liked".

>> No.63445092

GCC 8 & LLVM Clang 6.0 Compiler Performance On AMD EPYC - November 2017

>> No.63445094
File: 16 KB, 500x245, 1489301100403.jpg [View same] [iqdb] [saucenao] [google] [report]

>tfw you are a programmer that writes spaghetti code which likes to break and leak memory.

>> No.63445106

>Looks like perl and delphi is used way more than C.

That's not what I said, and I don't think there's some sort of linear relation between use and dislike, just that languages people actually use are disliked.

>Rust growing, almost as fast as go.

Kys, and I say that as someone who tried to get into Rust very early in its lifecycle.

>The only people who care about Rust at all are part of a cult following.

Probably true. I'm not even sure what it is that initially attracted them, except for Klabnik's extreme cuckoldry. Maybe it's because they used a bunch of disgusting subhuman commies in their official doc for Dining Philosophers?

>> No.63445116

Javascript is also an interesting showcase of why these graphs are useless: it's an absolute clusterfuck of a language, full of horrible design decisions that cause problems regularly, yet its userbase of webdev kiddies is perfectly happy with it because its the only thing they know, and desktop programmers just don't care to downvote it.

>> No.63445161

If 4gag ever had downvotes, Rust posts on /g/ would be the most downvoted ones. Just saying. No other language causes /dpt/'s buttpain reach to the extreme level than Rust or Java.

>That's not what I said,
Excuse me? If I recall correctly, you claimed that used languages are disliked and judging by the amount of dislikes perl and delphi got on SO, it's a no brainer to assume that those languages are used the most.

>just that languages people actually use are disliked.
So people do use delphi. And dislike it.

Still waiting for your proof by the way. I'm not shilling or defending Rust, there is a few dedicated autists ITT that do it. But I can see the appeal of Rust. If Rust didn't take itself too seriously on the security, I'd probably be using it too.

>> No.63445180
File: 19 KB, 300x300, steve.jpg [View same] [iqdb] [saucenao] [google] [report]

>shilling or defending Rust

>> No.63445183

Fuck yeah I wish I didn't have to use Delphi. You can't even use interfaces on objects that don't inherit from their shitty refcounted TSingleton type.

>> No.63445193

>If I recall correctly, you claimed that used languages are disliked and judging by the amount of dislikes perl and delphi got on SO, it's a no brainer to assume that those languages are used the most.

You need to learn how to read.

>So people do use delphi. And dislike it.


>Still waiting for your proof by the way. I'm not shilling or defending Rust


>> No.63445217
File: 76 KB, 550x550, stay cucked.png [View same] [iqdb] [saucenao] [google] [report]

>I got owned: the post
I don't remember the last time I lost an argument online . One of the perks of having malignant autism.

>> No.63445259

>No other language causes /dpt/'s buttpain reach to the extreme level than Rust or Java
I mostly just see people reacting negatively to concentrated Rust shilling. Useless language projects by delusional twats are a dime a dozen, but none of them get any attention here. The only thing unique about Rust is the propensity of its user base to invade discussions and push their subjective views down other people's throats. (Same thing SJWs do when it comes to politics. Pure coincidence?)

>I can see the appeal of Rust.
Anyone can see the appeal of Rust's selling points, but anyone who's used it can see that they border on fraud.

>> No.63445287

>but anyone who's used it can see that they border on fraud.

>> No.63445292

>but anyone who's used it can see that they border on fraud.
Not sure by "it" we mean the same thing here, but if you mean Rusts's integrated build tools (a git based package manager, standard centralized library repo and a check/benchmark/build tool) would you like to explain what's fraudulent here?

>> No.63445306
File: 131 KB, 643x767, XssKg8aQO9nSv2gbpkeBaFI8D4aEDJ3hcChOHJctTCs.jpgw643saa5eb9991eb4676b512e7b67a23115fb.jpg [View same] [iqdb] [saucenao] [google] [report]

>An ADT is type of data defined by the operations that it was designed to perform.
>The implementation of said tasks are hidden from the programmer using them.

What did he mean by this?

>> No.63445315

Time is money, Steve, and I want my time back.

>> No.63445323
File: 82 KB, 600x791, 1510915385532.jpg [View same] [iqdb] [saucenao] [google] [report]

How do install a ruby gem on windows


>> No.63445336

Does it have to be windows?

>> No.63445352

The fuck are you talking about you fucking autist? What's fraudulent about rust?

>> No.63445367

>if you mean Rusts's integrated build tools
No, I don't mean that. I mean "safety" and "zero cost abstractions".

>> No.63445382

>The fuck are you talking about you fucking autist?
Boy, look at you getting all ass-destroyed and exposing yourself for the Rust shill that you are.

>> No.63445386

Nothing is free of cost. Unless you are doing compile time function evaluation that is.

>> No.63445396

And Rust doesn't have CTFE if I remember correctly.

>> No.63445433

>Nothing is free of cost.
Of course they mean "zero overhead", but I guess "overhead" is too difficult a word for their target audience. That's not the point, though. "Zero cost abstractions" end up being used all over the place as language crutch, just to get code to pass the borrow checker, and when you end up with unnecessary borrow checking and reference counting just to prove things to the compiler and to avoid an unsafe block, you realize that you're either going to pay extra for these abstractions now, or give up safety guarantees.

>> No.63445444

>unnecessary borrow checking
By that I mean dynamic borrow checking in things like RefCell.

>> No.63445470

I see. I hold a similar opinion to you but aren't Rust's BC checked at the compile time? I'm not all too familiar with Rust, for a disclaimer.

Thing is, modern idiomatic C++ being reference counted, it's far more usable than Rust's Borrow Checker created cognitive overhead. Solves a problem that a very few people care about.

As a language, modern C++ is far more ergonomic than Rust in my opinion. Then again, when you join the big boys' club their difference is negligible.

>> No.63445543

It's checked at compile time, except if you use special constructs like >>63445444 that manage them dynamically.
I haven't had any need for RefCell personnally, so I don't really think it's a serious issue.
However, I think the borrow checker heavily
The cognitive overhead in Rust has been far smaller for me but I've been using C++11 and no shared_ptr, only unique_ptr.

>> No.63445548

>Then again, when you join the big boys' club their difference is negligible.
If by "joining the big boy's club" in Rust you mean using unsafe blocks when necessary, manually verifying correctness and doing things the C++ way, then no, you can't do that. Rust will assume that you're still following its borrowing rules inside unsafe blocks and perform optimizations that may be invalid. Pointer-aliasing-related stuff comes to mind.

>> No.63445579

>I haven't had any need for RefCell personnally, so I don't really think it's a serious issue.
The Rust devs obviously saw the need for RefCell and "interior mutability", so perhaps your opinion on whether or not it is a serious issue is just your opinion.

>> No.63445598

I'm not saying it's not needed at all, I'm saying it's not ubiquitous.

>> No.63445607

Note how phoronix shills clang by compiling Redis in debug mode with GCC and release mode with clang.

Sly dogs.

>> No.63445624

int iavg(int number1, int number2)
const int arr[2] = { number1, number2 };
return iavg(2, arr);

What, your language doesn't allow overloading? :)

>> No.63445687

What about community edition my dude?

>> No.63445688

>I'm saying it's not ubiquitous.
If your data structures happen to have cycles, and especially if you have to mutate nodes that can be reached in more than one way, they are very ubiquitous. I've seen some people use handles to imitate pointers to handle the situation. None of it is pretty.

>> No.63445693

Well done, truly excellent.

>> No.63445710

Does anyone have a good strategy to quickly gain an overview of a project?
I have been given a project and it is very large.
I think it actually works, but I want to use it to do my own thing, so obviously I need to find out what each function does and how they work together.
What is your method?
Do you just take an example and sketch the system?

>> No.63445711

What the actual fuck is this code doing? What's the point of calculating the error if you don't diffuse it and end up rounding either way?

>> No.63445723

>doesn't even compile a wrong answer

>> No.63445730

other than redis (the author still claims the test is legit in the comments) the results are disappointing since clang is still slower overall but googlel only supports clang

>> No.63445731

I don't care if it compiles or not. I'm just trying to understand the logic behind this. Are you trying to minimize the chances of overflow or something?

>> No.63445768

Jesus christ Applel cancer is truly undermining FOSS community inside out.

>> No.63445815

If it is an executable, just follow the line of execution/communication for a few examples.
Usually this gives a good overview of how things connect.
If it is a library work through a few common use cases and basically do the same.

>> No.63445853

It is a library, so my strategy is currently to follow the examples he provided and then write my own descriptions of what is in each file and how they call each other and draw a class diagram of the project.
Maybe doxygen can help me there.

>> No.63445873

It's trivial to average 2 numbers in OCaml

let avg a b = a / b;;

OCaml is (one of) the most powerful language on Earth.

>> No.63445893

why not use vectors instead.
Then is compiles.
Arrays are meant to be used for fixed sized data structures.

>> No.63445896

Now try doing some multi threaded programming

>> No.63445917
File: 235 KB, 1000x1000, stf,small,600x600-c,0,0,1000,1000.u5.jpg [View same] [iqdb] [saucenao] [google] [report]

why are gui frameworks so shit
im honestly considering just switching to a web gui for all my shit where possible

>> No.63445927

>ocamlniggers can't even average two numbers


>> No.63445936

>gui frameworks so shit
>better use HTML, CSS and JS instead
Do it, faggot. I dare you.

>> No.63445963

web frontend is an abomination BUT at least said abomination is portable across pretty much all platforms and devices, and is supported by almost every language in existence

>> No.63445970

Look if it isn't the anti-OCaml shill squad again. Do you mentally inferior creatures have nothing better to do than attack OCaml all day?

OCaml doesn't NEED multithreading, because multiprocessing is just as good for 99.9% of applications, and "ocamlniggers" can most certainly average 2 numbers:

let avg a b = (a + b) / 2;;

Meanwhile, you ALGOL 68 monkeys can't make up your minds on the correct way to do it. ALGOL monkeys are a pathetic little thing, always flinging their waste products at the superior ML users. Pathetic.

>> No.63445976


>> No.63446001

javafx duh

>> No.63446003

>OCaml doesn't NEED multithreading
Grapes are sourt too.

>> No.63446004

This program works fine with most text files but as soon as it tries to evaluate a file that contains certain characters such as { and }, it counts words when it shouldn't (for example, a file containing {word} is evaluated as containing one four-letter word, which is true, but also one five-letter word).
I can't pinpoint where this is coming from, could someone help

>> No.63446022

>he couldn't figure out how to remove "static const n"
Well done, truly excellent.

It rounds throughout the for-loop then one final time after it by checking the ending error. Apparently, the point is to return an integer average of two integers using modular arithmetic. I assume its structured this way to avoid using more precise/larger data types (i.e. doubles, floats, longs, etc.).

>> No.63446029

Does anyone have the leddit screencap announcing C should be banned and replaced with Rust? Asking for a friend.

>> No.63446041

>he uses the integer variant of + and /
dumb ocaml poster

>> No.63446049

>Average of 4 and 5 is 4
Well done, truly excellent.

>> No.63446060

You can use some html/css rendering library, you don't need to make the whole application webapp.

>> No.63446071

How is that better than QML or similar?

>> No.63446083

Has anyone here read Design Patterns? What language does it use for examples?

>> No.63446095

static_assert((4 + 5) / 2 == 4);

>> No.63446099

Design patterns give you design cancer.

>> No.63446105

>using a language where (4+5)/2=4
When will sepplets learn?

>> No.63446111
File: 291 KB, 701x762, __camilla_fire_emblem_and_fire_emblem_if_drawn_by_spewing_mews__413d2ff03f8bf49196bafae447468715.png [View same] [iqdb] [saucenao] [google] [report]

Nobody knows about ADTs?

>> No.63446124
File: 110 KB, 364x241, 1369782749529.png [View same] [iqdb] [saucenao] [google] [report]

What would you recommend?

>> No.63446139


>> No.63446150

Using your brain.

>> No.63446158

this is just too much for my tiny brain

template<class Ch, class Tr, class Tuple, std::size_t... Is>
void print_tuple_impl(std::basic_ostream<Ch,Tr>& os,
const Tuple & t,
((os << (Is == 0? "" : ", ") << std::get<Is>(t)), ...);

>> No.63446159

how bad at computers do you have to be when you can't comprehend the difference between integers and real numbers?

>> No.63446162

k, pajeet

>> No.63446170

Who said anything about integers?

>> No.63446172

You forgot a 't.' before 'pajeet'.

>> No.63446179

I didn't.

>> No.63446183

>Expecting an int (read integer (read WHOLE NUMBER)) data type to contain 4.5
Well done, truly excellent.

>> No.63446186

Why does your division operator return an int?

>> No.63446188

>What would you recommend?
That you approach design problems without preconceptions. Something may fit a pre-learned pattern quite well, but that doesn't mean it's the best way to do it.

>> No.63446192

4, 5 and 2 are all integers.
4+5 returns 9 as an integer.
9/2 returns 4 as integers always round by cutting off the remainder.
Here is a small division function:
int division (int a, int b) {
int abs_a = a, abs_b = b;
bool negative = false;
if (a < 0) {
abs_a = -a;
negative = !negative;
if (b < 0) {
abs_b = -b;
negative = !negative;
int result = 0;
int tmp = abs_a;
int shifted_b = abs_b;
for (int i = 31; i >= 0; --i) {
shifted_b = abs_b << i;
if (tmp >= shifted_b && shifted_b > 0) {
tmp -= shifted_b;
result += 1 << i;
return (negative ? -result : result);

>> No.63446198

How bad at computers do you have to be to think that (4+5)/2 should return 4 unless you explicitly round it?

>> No.63446205

>4, 5 and 2 are all integers.
That doesn't mean that the average of 4 and 5 is an integer, you retard. And you were asked to compute the average.

>> No.63446206

>9/2 returns 4 as integers always round by cutting off the remainder.
I wanted the average, no cutting off
Why should I be concerned about what data type you choose to return, brainlet? Is the notion of "average" too hard for you?

>> No.63446210

Line 34-35, two consecutive non-word characters will both enter the condition and thus execute ++freq[count]

>> No.63446235

People in this thread are too retarded.
I will leave this shithole called /dpt/ now.
Before I go and close this thread, please tell me of places where I can talk about programming without so many retards.

>> No.63446238

You have to be kidding me right? Can /dpt/ truly not average two integers?

>> No.63446242

nice blog

>> No.63446246

how bad at programming do you have to be to think that a function that averages two ints should return a non-int unless you explicitly specify the return type?

>> No.63446248

>t. (4+5)/2=4 langlet

>> No.63446254

>And you were asked to compute the average.
no, you just started to bitch about why (4+5)/2 returned 4 instead of 4.5 or 5.
>I wanted the average, no cutting off
Then use double or floats.
(4+5)/2. works. "2." means it is a float and it will return a float.
C is not meant to be a calculator, if you wanted a calculator, use a different language where doubles are the default.
It is a made up example anyway. No programmer would put numbers in their code.

>> No.63446257

Thanks, I never would've spotted this

>> No.63446263

If I ask you to write an algorithm to find the first recurring character in a string and you bust out indexOf, then sorry, you didn't get the job.

>> No.63446266

unironically reddit and hackernews but it's best to not do any of this gossiping/shitposting shit and just look up articles about specific things that you want to know about

>> No.63446267

I'm having trouble finding a way to track my weight-lifting progress that really fits what i want so i'm thinking about making something on my own. First thing is how i want to store the data. Any ideas? Ideally i would both able to both store weightlifting (sets, reps, weight per set) and cardio (running, biking)

>> No.63446276

>how bad at programming do you have to be to think that a function that averages two ints should return a non-int unless you explicitly specify the return type?
This has nothing to do with functions or specifying the return type. If you want an average function that, for some reason, returns an int, round it and return an int. (4+5)/2 should not, by default, equal 4. If you want that kind of behavior, have a separate idiv operator. The normal division operator should perform division, as it does in decent languages.

>> No.63446284

>asked to compute average
>writes a function that produces a wrong answer
>"mah C is not meant to be a calculator"
Everytime. The mental gymnastics Ctards do is truly an entertainment.

>> No.63446290

Yes. You were asked to compute an average. The average of 4+5 is not 4, and any language that yields 4 when you do (4+5)/2 is braindead.

>> No.63446298

Wtf, is this a javascript interview? Where am I exactly

>> No.63446299

nice shitpost retard

>> No.63446300

ok and what are the TIOBE ranks of these decent languages


>> No.63446301

I know there is almost a year until the T9 patent expires, but how would you implement it if you were to do it today?
I mean, assuming the dictionary is larger than what you would want to have in memory all at once, how would you make an efficient implementation where you also use the modern typo approach to it?

>> No.63446311

It wasn't my function. I just overloaded it(>>63445624) to poke fun at the autist saying the second argument wasn't a number. To answer your question as to why it returns an int, I'll quote my post >>63446022.
>I assume its structured this way to avoid using more precise/larger data types (i.e. doubles, floats, longs, etc.).

>Why should I be concerned about what data type you choose to return, brainlet? Is the notion of "average" too hard for you?
Someone's awfully triggered. :)

>> No.63446312

many languages do integer division when you have int / int

>> No.63446314

>what are the TIOBE ranks
I don't know and I don't care. Appeal to popularity is a logical fallacy. The fact remains that (4+5)/2=4 is counter-intuitive and usually unwanted behavior, so it should not be the default one.

>> No.63446316

unsigned int average(unsigned int a, unsigned int b)
return (a >> 1) + (b >> 1) + (a & b & 0x1);

Alternatively give this a read:

>> No.63446318

Where do you think this cancer originated from?

>> No.63446321

What is the advantage of std::bind over the good ol function pointer?

>> No.63446323

How would you calculate 9/2 in integers?
When I learned division, the result was 4 with a remainder of 1.
What would your answer be?

>> No.63446331

*tips neckbeard*

>> No.63446333

The concept of integers?
That is fucking old.

>> No.63446339

What a bunch of bullshit.
C# is just like Java and Java is trash.

>> No.63446346

Found your problem, webcuck.

>> No.63446347

>How would you calculate 9/2 in integers?
You weren't asked to calculate 9/2 in integers. You were asked to calculate the average between two numbers.
In C:
double avg = (x + y) / 2.0;

In a decent language:
let avg = (x + y) / 2;

Is that too hard for you?

>> No.63446354


>> No.63446358
File: 20 KB, 331x315, 12506712.jpg [View same] [iqdb] [saucenao] [google] [report]

>Average of -4 and 4 is now -2147483648
top kek. Now this one in particular is a comedy gold.

>> No.63446368

No, the stupid concept of an average being an integer

>> No.63446373

>returns an int

>> No.63446374

Current programming abilities?

I would go for sqlite. Imho your data files fits nicely in the table with rows model, (to you won't need relations afaict) it results in a single file that "just werks", and if one day you want to sell it as a webapp to other fitbros it will be relatively easy. It's also built-in in Python so go for Python 3 if you have no idea what to program it in. And there are nice web frameworks for Python. (Start with a command line program tho)

>> No.63446389

Actually, it's probably better to do this:
double avg = ((double)x + y) / 2;

Doubles have a 52 bit mantissa, so they can represent exactly the sum of any two 32-bit ints.

>> No.63446390

Why deal with SQL unnecessarily?
In Python he could just lazily pickle everything.

>> No.63446392

>an unsigned int at that

>> No.63446403

>Average of two integers is an integer
Holy shit the current state of /dpt/

>> No.63446409
File: 97 KB, 971x306, Screenshot_2017-11-19_13-47-59.png [View same] [iqdb] [saucenao] [google] [report]

sepples condensed into one picture

>> No.63446417

When programming AVR devices, is it a bad practice to define all global variables with volatile keyword?

>> No.63446421
File: 116 KB, 645x729, 1508387017336.png [View same] [iqdb] [saucenao] [google] [report]

It's mostly the under-developed apes called ctards, anon.

>> No.63446422

No schema, version incompatibilities, won't scale for shit. Dunno why you would ever go with that outside of baby's first serialisation.

>> No.63446430

>how would you calculate the average between two numbers
I would use double precision floating point numbers instead of integers.
You bitch and moan about you not understanding basic math and or the syntax of a language.
YOU are the one too retarded to understand that integers are a subset of real numbers.
You did not take the average, you added two integers then divided the result of that with an integer.
The result remaining an integer makes sense to everyone, acting like you are confused about something this simple is not really clever, it is just stupid.
I don't know what mental institution you learned math in, but you are clearly wrong here.
You cannot learn programming by refusing to understand what you write means.

>> No.63446442

>baby's first serialisation.
that's all he needs

>> No.63446447

>You bitch and moan about you not understanding basic math
Then how come I know that (4+5)/2 =/= 4 and you don't?

>and or the syntax of a language.
Then how come I can successfully calculate the actual average of the integers 4 and 5 in C while you can't? You're a literal subhuman.

>> No.63446448


>> No.63446462

>You did not take the average, you added two integers then divided the result of that with an integer.
I didn't do anything, I just wanted ctards to write a function that computes the average of two integers. So far I haven't go a correct program/function.
>The result remaining an integer makes sense to everyone
Everyone who failed primary level maths I suppose.
>but you are clearly wrong here.
I'm not. Let me teach you two things today, ctard:
1. Average of 4 and 5 is 4.5
2. Average of 4 and -4 is 0.

Plain and simple. Go back to primary schools, brainless ctard.

>> No.63446466

Thank you.

>> No.63446469

feminine hand penis

>> No.63446473

>So far I haven't go a correct program/function.

>> No.63446476

Beginner-ish, programmed a bit but almost never full projects. Mostly academic stuff.

And yeah i would prefer to use python, should probably have specified that.

How would the structure be then? having weightlifting sets is easy enough, but what if i wanted something like running? preferly with some split times and stuff like that.

>> No.63446480

I want to see linkedin profiles, but they block me most times, requesting that I sign-up.

Example: https://www.linkedin.com/in/williamhgates
> Join to view full profiles for free

How can I bypass this?

I used to throw the link into GoogleTranslate and use that as a proxy, but now even that fails (500 server error).

Any other ideas?

>> No.63446484

Use tab-separated, flat text files

>> No.63446488
File: 61 KB, 331x315, 125067188.jpg [View same] [iqdb] [saucenao] [google] [report]

That's not averaging two integers though, that's averaging a double and an integer.

>> No.63446502

>That's not averaging two integers though
int x = 4;
int y = 5;
double avg = ((double)x + y) / 2;

x and y look like integers to me. avg is their average. Literally everyone in this thread is subhuman, starting from you and ending with the Ctards who think (4+5)/2 = 4.

>> No.63446510

Might as well just use Python's csv module

>> No.63446513

The autism is real.

>> No.63446520

God please no

>> No.63446543

int iavg(int n, const int arr[static const n])
int avg = 0;
int rem[2] = {0, 0};
int add[2] = {0, 0};

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int a = abs(arr[i] % n);
int j = arr[i] < 0;

if (rem[j] >= n - a) {
rem[j] = a - (n - rem[j]);
} else {
rem[j] += a;

avg += add[0] - add[1];

if (avg < 0 && rem[0] > rem[1])
else if (avg > 0 && rem[0] < rem[1])

int main(){
const int* arr = {5, 3, 5, 6, 5};
iavg(5, arr);


>> No.63446544

>x and y look like integers to me.
That is until you converted x from an integer to a float lmao

>> No.63446555 [DELETED] 

typedef struct {
int num, denom;

Fract div(int x, int y) {
return (Fract){x, y};

The only objectively correct answer.

>> No.63446562

>That is until you converted x from an integer to a float lmao
It doesn't matter. The result is the average of x and y, which are integers. You are a confirmed subhuman.

>> No.63446566

>typedef struct

>> No.63446571

>returns an int

>> No.63446581

typedef struct {
double num, denom;

Fract div(double x, double y) {
return (Fract){x, y};

Fract avg(int x, int y) {
return div((double)x + y, 2);

>> No.63446589

>double num, denom
LMAO /dpt/

>> No.63446596

Not an argument. This will accurately represent the average of any two ints.

>> No.63446601

>typedef struct
Fuck no.

>> No.63446605

>x + y
No it won't.

>> No.63446609

>moving the goalpost
Get fucked. It represents the average of two ints.

>> No.63446620

>No it won't.
But it will, you fucktard. What makes you think otherwise?

>> No.63446622

>I-It represents it, I swear!
That's nice, now get it in a form that is actually useful.
No one wants to deal with your shitty Fract struct.

>> No.63446628

I don't care about your 2 ints, slut. Don't typedef structs. It makes using those types less clear.

>> No.63446640

Because addition overflows, fucktard. That's exactly the issue we're talking about you fucking retard.

>> No.63446648

>attempting to move the goalpost again
You did not specify any standard of precision, so everything from returning an int to returning a double may be "actually useful", depending on the intended usage. As for something that strictly complies with the original requirements, the given solution does. Get fucked, retard.

>> No.63446653

Install golang

>> No.63446656

I hate those places.
Even if there would be a lesser percentage of retards on there, the users are insufferable all the same.
Guess I will have to code in solitude...

>> No.63446657

This average two integer/number talk is just like the Rust string vs C string talk. A huge waste of time.
Go back to programming Linux Kernel trash.

>> No.63446658
File: 28 KB, 456x620, 12713949.jpg [View same] [iqdb] [saucenao] [google] [report]

>> No.63446661

>Because addition overflows, fucktard.
Examine the code carefully before you spew your vomit, subhuman animal. No overflows are possible there.

>> No.63446672

Because double has an infinite number of bits, right?

>> No.63446673

Go back to averaging ints for a living.

>> No.63446678

You happy now my man?

>> No.63446687
File: 6 KB, 713x40, Screenshot from 2017-11-20 00-16-47.png [View same] [iqdb] [saucenao] [google] [report]


>> No.63446698

>Because double has an infinite number of bits, right?
Double has 52 bits of mantissa. Ints have 32 bits in C. You only need 33 bits to represent the signed sum of two ints. A double can represent this sum with no precision loss and no overflows.

>> No.63446700

>Ints have 32 bits in C
Try again

>> No.63446711

Come back when you find a C implementation where int is 64 bits by default.

>> No.63446731

FILE *fp;
char expr[255];
float avg;

sprintf(expr, "dc -e \"5 k %d %d + 2 / p\"", a, b);
fp = popen(expr, "r");

fscanf(fp, "%f", &avg);

return avg;

What do I win?

>> No.63446732

>m-muh implementations!
Do the fucking implementations write the standard? No they fucking don't.
It's incorrect faggot. Deal with it.
You are relying on implementation defined details and possibly invoking UB.

>> No.63446749

ruby =/= ruby on rails
you idiot

>> No.63446754

>It's incorrect faggot. Deal with it.
It is correct on any platform that anybody cares about. Either way:
#define int int32_t

Get fucked.

>> No.63446762

Nice damage control.
Throw yourself off a cliff, dumb Ctard. No one wants to run your horrible buggy UB-ridden code.

>> No.63446763
File: 825 KB, 700x700, 4d7.png [View same] [iqdb] [saucenao] [google] [report]

quick /dpt/, give me the best book for babby learning C

>> No.63446767

I knew this had to exist somewhere. Thank you Microchip.
#ifndef int24_t
typedef signed short long int int24_t;
#define int24_t int24_t
#define INT24_MIN (-8388608L)
#define INT24_MAX (8388607L)

#ifndef uint24_t
typedef unsigned short long int uint24_t;
#define uint24_t uint24_t
#define UINT24_MAX (16777215UL)

>> No.63446782
File: 142 KB, 511x564, you know it's true.png [View same] [iqdb] [saucenao] [google] [report]

>This average two integer/number talk is just like the Rust string vs C string talk. A huge waste of time.

You've come to the wrong place friend. No one on /dpt/ actually programs, they just learn enough programming to argue about basic language features, and then go on to treat languages like it's their favorite football team.

>> No.63446808

>be you, a subhuman animal
>y-y-you can't average two ints
>gets a trivial solution that averages two ints
>n-no! it could in theory overflow for some numbers on some obscure platforms!
No one cares. Get fucked.

>> No.63446810

>Rust string vs C string talk
C doesn't have strings though.
pointer to a constant character isn't a string.

>> No.63446823

Ok, I suggest "If you aren’t learning rust and go today, you’re going to be left behind five years from now." for a next thread theme

>> No.63446824

>>gets a trivial solution that averages two ints
Where? I didn't see it.

>it could in theory overflow
Which is true, and therefore you're implementation is wrong.

>> No.63446829

types don't exist.
It's just syntactic sugar the compiler removes.

>> No.63446833

type casting is ugly

>> No.63446845

>I didn't see it.
Right here: >>63446581

>b-but in theory
No one cares. You got fucked.

>> No.63446857

That's obvious, retard. When did you figure that one out?
We have types for a reason. Though a Ctoddler like you wouldn't understand.
Now go back to your playpen, the grown ups are talking.

>> No.63446863

c++ is just as safe as rust to a good programmer, espcially with shared_ptr<>. That said, a bad programmer can commit murder in any language, safeguards be damned.

>> No.63446873


>> No.63446896

how do you even program like that?

;0 uɹnʇǝɹ
( []ʌƃɹɐ* ɹɐɥɔ 'ɔƃɹɐ ʇui )uiɐɯ ʇui

>> No.63446897

Does this seem like a good fix to >>63446004? It seems to run properly and return accurate values but perhaps I've missed something.

>> No.63446901

People actually use those? I still prefer raw pointers to shared_ptr<>, unique_ptr<> are good though.

>> No.63446902

>paranoid aussie
They're called bogans, you uncivilized orc.

>> No.63446905

compilers don't exist
Its just semantic glue the operating system removes

>> No.63446906

>>I didn't see it.
>Right here: >>63446581
Sorry, I'm not see any code that matches the description of "trivial solution that averages two ints".
I do see code that matches the description of "buggy incorrect UB-ridden piece of shit" though.

>No one cares. You got fucked.
You never fucking depend on undefined or implementation defined behavior, unless you are programming for a specific platform and know the behavior.
How fucking hard is it for a Ctard to understand this simple thing? If it violates the standard, it's WRONG.

>> No.63446939

>I do see code that matches the description of "buggy incorrect UB-ridden piece of shit" though.

>unless you are programming for a specific platform and know the behavior
That's exactly what I did, tard, and you got fucked.

>> No.63446950

>That's exactly what I did, tard, and you got fucked.
And you have absolutely no valid reason to do so, therefore your code is utter trash. Pretty typical of C code though.

>> No.63446998

>And you have absolutely no valid reason to do so
I have a perfectly valid reason to do so: it works on every platform I care about, and trying to get something to work on every conceivable platform has diminishing returns and a negative impact on the vast majority of sane platforms. Next time make it an explicit requirement next time, tard. You got fucked. Go get your anus stitched.

>> No.63447000

Programmers roll out


>> No.63447001

>babby learning

Try Problem Solving and Program Design in C and then run trough K&R

>> No.63447045
File: 1 KB, 258x60, mean.png [View same] [iqdb] [saucenao] [google] [report]

>1. Average of 4 and 5 is 4.5
>2. Average of 4 and -4 is 0.
It can be.
Integers are not some dumb data type computer scientists came up with to fuck with your narrow understanding of mathematics.
You are assuming pic related which was not specified and therefore not assumed by whoever wrote the first meme response.

In most cases, you want the input and the output to share the same subset.

>> No.63447091

>In most cases, you want the input and the output to share the same subset.
That's most certainly not the case here, brainlet

>> No.63447103

> Being tired of retards in thread then asks retards for non 'tard places to browse
You sound retarded

>> No.63447114

>average two ints in C
>no other type specified for the return type

>> No.63447132

>>average two ints in C
Yeah, and?
>>no other type specified for the return type
Why the fuck should I spoonfeed that to you?

>> No.63447185

>you are assuming that average means average and integer means integer
>narrow understanding of mathematics
Your damage control is hilarious. Integers in computer science are the same as integers in mathematics, and so is division, and so is the concept of the average. It's just that integers in C are not the same as integers in mathematics, and neither is division, so your Ctard reflexes yield a wrong result.

>> No.63447281

That's why he's here.

>> No.63449081

>not just a.sum / a.length;
Blew it

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.