[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: 321
Thread images: 29

File: lain.jpg (59KB, 1008x720px) Image search: [Google]
lain.jpg
59KB, 1008x720px
What are you working on, /g/?

Old thread: >>62441175
>>
>>62446298
Null-terminated byte arrays
>>
wannacry v2.0
>>
File: 1503781260947.jpg (1MB, 610x5332px) Image search: [Google]
1503781260947.jpg
1MB, 610x5332px
Remember that the best programmers work with the best languages.
>>
>god tier
2^n
>top tier
n
>high tier
m/2^n
>meh tier
m/n
>shit tier
irrational numbers
>oh shit nigga what are you doing tier
complex numbers
>>
>>62446340
>not even shitty enough to be ironic
>>
>>62446298
let's all love lain
>>
>>62446340
That just reflects the opposite of your random opinion, not anything funny or relatable.
>>
>>62446383
Also check out http://www.megaprocessor.com/index.html . The guy has a youtube channel where he explains everything.
>>
any phycicist here i have a quick simple question
>>
>>62446497
What do you want?
>>
Why are general CPUs so bad at dealing with floating-point calculations?
>>
>>62446531
They are?
>>
>>62446497
Albert Einstein here, AMA.
>>
>>62446525
your mom
>>
>>62446497
>>62446525
kek
>>
>>62446535
Yes, that's why FPUs exist
>>
>>62446550
FPUs go in the CPU
>>
>>62446536
>>62446525
is this a correct way to describe projectile motion in 3d
here is the formulas
Vx(t) = Vxo - drag*t
Vy(t) = Vyo - g*t- drag*t
Vz(t) = Vzo - drag*t


X(t) = Vx(t)*t+Xo
symmetric formula for y and z dimensions
>>
>>62446550
People still use FPUs as coprocessors?
>>
>>62446531
>he doesn't know about AVX2
>>
>>62446357

> 2^n is god tier
> complex numbers below shit tier
> powers of 2 are a subset of C.

Learn maths please, anon.
>>
File: react.png (36KB, 634x490px) Image search: [Google]
react.png
36KB, 634x490px
Are you ready for that huge salary, /dpt/?
>>
>>62446568
>euler integration
absolutely disgusting
>>
>>62446497
Given an arbitrary system of equations, why is direction in space "stored" in the variables when considering the system as linear equations, but "stored" in vectors when considering the system as a vector equation? For example suppose we have a system of three equations in three variables where each equation is of the form (a_i)x + (b_i)y + (c_i)z = d_i. Lets also suppose they represent three distinct planes in R^3 (so we have linear independece). In the context of the system representing planes in space, it seems to me that dimension/direction is sort of "stored" in the variables x, y and z.
Considering the system now as a linear combination of vectors, the coefficients associated with any one variable make a column vector. The vector equation associated with the system would then be xv_1 + yv_2 + zv_3 = . In this context it seems as though dimension/direction is stored in the vectors, and the variables x,y, and z now just scale them.
It is even more strange to me that these three planes can also be defined as vector equations by dotting the normal vectors with a vector parallel to the given plane and setting it equal to 0
Back to the original question, I realize that both contexts have the same solution set, and both take place in R^3, but is there a more intuitive explanation for this relatedness?
>>
Any physicists here? I want to kick your ass.
>>
Can unresolvable circular dependencies exist (in C)?
>>
>>62446732
I used to be really into functional reactive programming but looking back I have no idea why.
>>
>>62446723
>maths
like i'm going to listen to sumone who can't even proper english lmao
2/10 made me replie
>>
>>62446880
>Can unresolvable circular dependencies exist (in C)?
Not sure what you're even asking. You can have whatever circular dependencies you want. Just use forward declaration.
>>
>>62446298
My current coding project is driving a small OLED display from the GPIO of a raspberry pi zero,
>>
Any anime lolis here? I want to sniff you
>>
>>62446859
Show me your General Lambert's Problem Solver.
>>
>>62446815
aha so you agree with the equations
whether a vector or just 3 equations literally doesn't matter conceptually, it's basically the same thing

maybe you'd have me write fucking vectors in my post or what
anyways i got what i wanted, ty
>>
>>62445865
You're right that this is retarded, but the solution would be to invalidated that syntax rather than changing the meaning.

int *i, j


Perfectly represents what's happening. That *i and j are both integers.
>>
File: a41f3373ea1e437483155958969ed7c2.jpg (254KB, 1920x1080px) Image search: [Google]
a41f3373ea1e437483155958969ed7c2.jpg
254KB, 1920x1080px
best program ever
>>
>>62447180
>Perfectly represents what's happening.
It doesn't, and the reason has already been explained half a dozen times by now. If you're too much of a brainlet to grasp it, that's your problem.
>>
>>62447231
So you are saying that
>That *i and j are both integers.
is wrong?
>>
File: 1477938580353.jpg (91KB, 720x720px) Image search: [Google]
1477938580353.jpg
91KB, 720x720px
>>62447029
That sounds pretty lewd, anon-kun.
>>
how can I keep my functions organized? Basically I have one huge loop that looks like this:

class 1
big loop {
call class 1 function 1
call class 1 function 2
}

class 2
function 1: login
function 2: another loop{
get data
if data requires further analysis call class 3 function 1
}

class 3
function 1: analyze data. if data is viable send it to function 2
function 2: send analyzed data back to server

and basically each function is about 150 lines of code. I'm just having trouble keeping it organized because the functions are iterative, you can't send all the data back to the first class and control it all from there because each data point in class 2 function 2 has to go to class 3 in an iterative fashion.

idk if I'm making sense but there you have it
I know I could control it all from one loop but I don't know if that would be worth the investment of time really
>>
Can we agree that
int* i;
and int *i both make sense but the former is simply more clear and scalable?
>>
>>62447333
Correct, if only that's how the language actually worked.
>>
>>62447315
shit I meant
*call class 2 function 1, etc.

for the functions in class 1
>>
https://github.com/ansuz/RIIR/issues/1
I love this
>>
>>62447339
In theory. If you're talking about C specifically then only the latter makes sense.

Personally I prefer x: *T to either of those.
>>
>>62447333
Can't we all agree that
*int i;
is the one true path?
>>
>>62447278
I am saying that this is completely irrelevant. "int *i;" takes part of the type descriptor and glues it to the name, breaking the established pattern that the type descriptor comes first, and the name comes second. This is the objective fact of the matter. Your opinion about the helpfulness of this inconsistency is a purely subjective matter. The objective fact is that it causes an inconsistency that doesn't make sense to everyone.
>>
>>62447398
Now this is patrician.

>>62447361
I don't like the
identifier: type
style but otherwise, perfect.
>>
>>62447398
That's not valid C you dumbfuck.
>>
>>62447406
You're not saying anything about how it doesn't perfectly represent what is happening. In a variable declaration, the fact that something is a pointer is part of the name. End of story. It's unfortunate, but that's how it works.
>>
>>62447414
It's the best option if you want type inference. Otherwise you need something like "auto" because there's no indicator of whether the type is present or not for parsing (: serves that purpose).
>>
>>62447440
>You're not saying anything about how it doesn't perfectly represent what is happening
It doesn't perfectly represent what is happening, because *i represents dereferencing i, and what's actually happening is that a variable named i is defined, and that variable has the type int*. You are mentally retarded, your opinion is inherently invalid and this discussion is closed.
>>
>>62447473
Saying "i is an int*" is the same as saying "*i is an int".
>>
>>62447469
I see your point, and that can lead to the rather elegant
inferred := foo(); explicit: type = foo();
style.
But I'm not sure I'm still entirely sold on it. In the end I don't think it matters very much.
>>
>>62447505
>Saying "i is an int*" is the same as saying "*i is an int".
It literally isn't, you fucking cripple, because the definition of variable i is about the variable i, not about the value held in the address held by variable i.
>>
>>62447420
>not writing your own compiler
>>
>>62447505
int *ptr = malloc(sizeof *ptr);
ptr = malloc(sizeof *ptr)

defend this inconsistency
>>
>>62447525
Correct, you are defining a variable i and saying that *i is an int, which means i is an int*. It's rather roundabout but there's no misrepresentation.
>>
>>62447546
I won't, because there was no mention of assignment in the discussion before this.
>>
>>62447505
>declaring an int should look like this: *0=0 i, because this represents exactly what happens when you do i*0
This is literally what you're saying.
>>
>>62447525
This. The strict aliasing rule can get fucked.
>>
>>62447577
strict aliasing is fine nigger, lrn2 use unions
>>
>>62447551
>*0=0 i;
You are defining a variable named i and saying that i*0=0, which means i is an int. It's rather roundabout but there's no misrepresentation.
>>
>>62447576
>>62447595
This is just turning into insane rambling at this point.
>>
>>62447604
this is why you shouldn't try to grok C
>>
>>62446577
Everyone except you
>>
>>62447134
What was it you were after?
>>
>>62447604
But it's literally your proposal. You're the one unironically insisting we should do exactly that.
>>
>>62447631
Where?
>>
>>62447588
I'm mocking the kid who I responded to. The strict aliasing rule implies that the address held by variable is only for derefrencing ints. So yes, they are the same, implies otherwise means that address can be used for other purposes, which is UB.
>>
>>62447637
when you suggest that it's reasonable to declare something by what happens when you use it rather than by what it is.
>>
I real human beings can solve the halting problem, why can't programs?
Checkmate computer "scientists"
>>
>>62447663
I didn't say it was reasonable, I said it was valid. And it was only in reference to type.
>>
>>62447683
Because you don't understand the meaning of the halting problem.
>>
>>62447637
Let's review your argument:
>int *i; is appropriate because it describes what happens when you dereference 'i' (you get an int), and from this you can deduce that the type of 'i' is a pointer to an int
>*0=0 is appropriate because it describes what happens when you multiply 'i' by the integer 0 (you get an integer 0) and from this you can deduce that they type of 'i' is an int
This is your logic, not mine.
>>
>>62447709
First of all, the latter statement is false. Second of all, I didn't say it and it doesn't follow from the first statement.
>>
>>62447725
>the latter statement is false
Prove it, faggot. 0 (as opposed to 0.0 or 0.f) represents the integer 0 in C.

>I didn't say it and it doesn't follow from the first statement.
Either your first statement is a non-sequitur, or the second statement does follow from argument. There's no way around it.
>>
>>62447771
You didn't use == in that expression, so it's invalid C. But now that you have explained your reasoning, and if it worked that way, I suppose it would make sense. Not sure what point you're trying to make here.
>>
>>62447595
>>62447631
>>62447709
Multiplication and deference are not the same operator you moron.
>>
where is my real life lain equivalent?
>>
>>62446815
bumping this out of curiousity
>>
>>62447833
Actually, better to say *i is a valid C expression whereas (*0=0 i) absolutely isn't. Also, (i*0==0) is still true even if i is a float, so I take that back, it doesn't make sense.
>>
>>62447902
what does the * mean?
and why do i sometimes see things prefixed with &?
>>
File: 1505227007773.jpg (49KB, 369x595px) Image search: [Google]
1505227007773.jpg
49KB, 369x595px
Why should I use a unit testing framework instead of writing a bunch of tests directly into my code?
>>
>>62447833
>Not sure what point you're trying to make here.
The point is that your argument is not an argument. I could easily come up with something equally absurd that is valid C and effectively describes something fundamental about a type from which the type could be deduced. Clearly "it perfectly describes what happens" is irrelevant.
>>
>>62447923
*p is the variable stored at address p.
&x is the address of the variable p.
>>
>>62447855
You are literally subhuman. Please remind me why "people" like you have rights.
>>
>>62447937
What about ->?
>>
>>62447929
Does your language provide a way to disable said tests
>>
>>62447959
I could just put them behind an ifdef in C, so yes.
>>
>>62447902
>0 0*i;
0*i is a perfectly good C expression, and when you do this, you get the integer 0, so clearly this is an appropriate way to define a variable 'i' of type int, because it perfectly describes what happens.
>>
>>62447955
x->y is shorthand for (*x).y
>>
>one inane discussion followed by another
>>
>>62448004
thanks
>>
>>62447932
>I could easily come up with something equally absurd that is valid C and effectively describes something fundamental about a type from which the type could be deduced.
It would not be the best way to declare the variable, but it would not be WRONG, and it would not be better than how C does it. As long as you accept that then whatever. I don't even like C and I especially don't like how it expects you to declare pointers.

>>62447955
p->x = (*p).x

>>62447992
Under C's rules, 0 is also a float, so no, it's not correct to say that you can deduce i is an int from that. Unless you wish these "declaration expressions" to follow different rules from the rest of C.
>>
>>62448044
0 is not a float, 0 implicitly converts to the float 0.0f.
>>
>>62448065
It's the same thing. i*0 == 0 is true if i is a float.
>>
>>62448078
>It's the same thing
Next thing you'll tell me that arrays are identical to pointers and that
void foo(int arr[]);
is a valid way to declare a function prototype.
>>
>>62448130
They might as well be the same thing since you can't distinguish between them except in syntax. Why are all your arguments based on slippery slopes, anyways?
>>
>>62448044
>it would not be better than how C does it
So you mean using syntax to "describe perfectly what happens" isn't generally better than a type descriptor followed by a name? Guess your "argument" was intended to be a non-sequitur, then?

>Under C's rules, 0 is also a float
If 0 was a float, multiplying by it would result in an implicit cast to float like multiplying by 0.f. That is clearly not the case because 0 is the integer 0.
>>
>>62448078
>i*0 == 0 is true if i is a float
Are you retarded? Both sides are implicitly cast into floats as a result of 'i' being a float. You don't even fucking know C, why are you arguing about it? Fucking brainlets...
>>
>>62447992
>>62447952
>*0=0 i

Doesn't make sense. What does "*0" even mean? You can't dereference a literal. What is your argument?
>>
>>62448146
I wasn't even the one who originally said "describe perfectly what happens", I was refuting the idea that you couldn't deduce i: *int from *i: int. Then everything got out of hand with ridiculous extrapolations.

>>62448178
Doesn't make it not true.
>Unless you wish these "declaration expressions" to follow different rules from the rest of C.
>>
>>62448193
You're a retard who doesn't understand C and can't form an actual argument. Off you go.
>>
>>62448193
> I was refuting the idea that you couldn't deduce i: *int from *i: int
So you were refuting something no one ever said at any point? Did you forget your medication again?
>>
>>62448237
That's rich coming from someone whose best attempt at an argument this thread was a strawman that didn't even work.
>>
>>62447902
>Also, (i*0==0) is still true even if i is a float
Not if i was nan.
>>
>>62448188
Please, stop shitting and drooling all over everything and providing justifications for state-enforced sterilization.
>>
>>62448257
>>62447525

>>62448263
Good point.
>>
>>62448014
welcome to 4chan
>>
>>62448261
It actually destroys your entire position. Your double-digit IQ just doesn't allow you to see that your "argument" is either a non-sequitur or leads to bizarre absurdities.
>>
>>62448272
Not an argument. No of the syntax you propose makes any sense.
>>
>>62448155
You will need categorical logic to deeply answer your question.
>>
If I have a file, and a 32 bit checksum, whats the best way to find the method used to generate it? I quickly checked Adler, Fletcher, and crc, but it doesn't look like those unless I'm getting screwed by endianess.
>>
>>62448155
Probably inspired by "monoid".
>>
Can someone give me the tl;dr on unit tests? What are they and how do I write them? How do they function? What do they do?
>google it
would appreciate a beginner-friendly version specially tailored for me and my autism
>>
>>62448290
The only thing I am arguing is that if *i is an int then i is an int*. This is due to strict aliasing.
>>
>>62448292
>No of the syntax you propose makes any sense.
Correct, and this fact destroys your position, because this absurd syntax follows from your logic.
>>
>>62448339
A unit test is where you give a program (or subprogram) an input and check that you get the expected output.
>>
>>62448339
test for a single function
>>
>>62448340
>The only thing I am arguing is that if *i is an int then i is an int*
So you're arguing with yourself about something that bears no relevance to the original topic of discussion? Good job.
>>
>>62448359
>>62448355
So if my program has thousands of functions, I have thousands of unit tests?
>>
>>62448362
The original response to that was that it was false, not irrelevant.

>>62448372
Sure, if you want to test them all.
>>
>>62448362
>So you're arguing with yourself about something that bears no relevance to the original topic of discussion? Good job.

slight variation of this and it'd make a great banner
>>
>>62448378
>original response to that was that it was false, not irrelevant.
The original response was that *i doesn't describe what happens in that line. You then moved the goalpost to "it described what happens when you dereference the variable, and the type can be deduced from that", which I've shown to be irrelevant. Move on, faggot.
>>
>>62448295
The only way to be sure is poking into the program which generated the file.
32 bit checksums have way too many collisions, so even if you did calculate an identical sum with say crc, you still couldn't be sure the original program used crc.
>>
>>62448348
>Correct, and this fact destroys your position, because this absurd syntax follows from your logic.

No it doesn't. When I say it doesn't make sense I mean I literally cannot make head or tails of it. Maybe I'm just retarded but can you walk me through what this is even supposed to be?

>*0=0 i

Because to me this reads as

>dereferenced 0 is assigned the value of 0(i)
>>
>JavaScript is a me...
https://remedygames-careers.jelpp.com/ui-programmer-595a3140f3748d3071b55d72/info?source=jelpp
>>
>>62448482
>UI designer
That's not programming, js is meme.
>>
>>62448436
That was just a loose interpretation of "it perfectly describes what happens". If it triggers your autism so much, here's an alternative that conforms to your arbitrary standard:

>int *i; is appropriate because it describes what happens when you dereference 'i' (you get an int), and from this you can deduce that the type of 'i' is a pointer to an int
>0 0*i; is appropriate because it describes what happens when you multiply 'i' by the integer 0 (you get an integer 0) and from this you can deduce that they type of 'i' is an int
>>
File: tk.jpg (5KB, 156x208px) Image search: [Google]
tk.jpg
5KB, 156x208px
Is there a site with some sort of daily programming challenges or something?
I haven't done much with java in months and I want to get my skills up again for school
>>
>>62448540
codewars ?
>>
>>62448540
make me an app that pulls an OP from 4chan and displays it in a window that is always on top
>>
I looked at my CS program and they're going to teach us C, Java and C#. What language should I look in to to complement these?
>>
>>62448611
LISP, OCaml or Haskell
>>
>>62448512
>0 0*i; is appropriate because it describes what happens when you multiply 'i' by the integer 0 (you get an integer 0) and from this you can deduce that they type of 'i' is an int
Only if you make up new rules.
>>
>>62448611
perl
python / ruby
haskell, prolog, lisp, erlang, smalltalk
>>
>>62448512
You can't make that deduction though. i could be const, long, or anything else that would evaluate to the integer 0 when multiplied by the integer 0.
>>
If I realloc will the addresses remain the same?
int *buf = malloc(sizeof(*buf) * 2);
int *testp = buf + 1;
buf = realloc(buf, sizeof(*buf) * 3);

Will testp still point to the second element of buf or does it point to somewhere else?
>>
>>62448611
language dont really matter
>>
>>62448682
no, realloc can move the buffer if it can't grow it in-place
>>
File: 1451427410862.png (745KB, 598x892px) Image search: [Google]
1451427410862.png
745KB, 598x892px
>program mainly in forchan
>need to write in python for the first time
I need to parse a file. It has a fairly simple structure - coordinates of nodes, routes, and two different states of nodes.
What should I use to save the result? I only know how to tune bytes, I don't know tuples, lists and objects.
>>
>>62448653
>>62448630
Thanks. And what about C++ ?
>>
>>62448641
It's exactly the same logic. If you don't consider the second statement logically valid, then neither is the first one.
>>
>>62448611
So they are going to teach you basic procedural language, OOP language, then C# for some goddamn reason.

Just to fill out basic knowledge I would learn some basic web programming HTML/CSS/JS; SQL and basic database theory if they really aren't going to teach you that (which I doubt); a functional language or at least how to program functionally in a well known language like Python or Java 8+; and finally a refresher and in depth study of C and learn an assembly language (microcontroller boards help) which will help you understand computer hardware, the OS, buildtools, etc.
>>
>>62448728
see >>62448677

You're just a brainlet.
>>
>>62448722
obviously you should learn it
if you know Java and C the basics should be really easy
anything related to template metaprogramming is pain though
>>
>>62448677
>i could be const, long, or anything else that would evaluate to the integer 0 when multiplied by the integer 0
Okay.
>int *(&i);
>int typeof(i);
>etc.
Are you really so mentally handicapped that you can't see why your argument is inherently invalid regardless of that?
>>
>>62448745
>You're just a brainlet.
But you're the one whose mind is too subhuman to process the root of its error even though it's obvious despite the flaw in that example.
>>
>>62448722
>C++
Avoid at all costs, unless you want to lose your faith in the entire field.
>>
What's wrong with lazy evaluation?
>>
>>62448947
Hard to master.
>>
>>62448947
inherent overhead over strict evaluation
>>
>>62448947
It's fine when it's what you want. It shouldn't be the default. Lazy semantics can be easily implemented in terms of strict semantics.
>>
>>62448785
>>62448805
>int *(&i);
>int typeof(i);

These make sense as alternatives to declaring ints but that's obviously pointless obfuscation. It's an absurd argument that ignores practicality.

int *i, *j;
has the practical benefit of only needing the one * operator that takes a right operand.
int* i, j;
means we have a new * that takes a type as a left operand.
>>
>>62448947
>What's wrong with lazy evaluation?
Time and space leaks. It happens when you manage to build up a huge series of thunks over time, eating up memory and causing a long pause when the value is finally needed and the delayed computations have to be performed all at once. This forces you to constantly maneuvering around an invisible obstacle when structuring your code.
>>
>>62449110
You are retarded. It's not an argument, but an illustration of the fact that you have made zero valid arguments so far.
>>
>>62449110
>int *i, *j; has the practical benefit of only needing the one * operator that takes a right operand. int* i, j; means we have a new * that takes a type as a left operand.
This is why it should have been
*int i, j;
instead.
>>
>>62449167
The argument is that because these absurd examples also logically make sense, that practical examples are just as absurd.

You could apply the same argument the other way. Instead of int i; you could have
typeof(int) i;
. Completely logical and completely absurd but doesn't means there's anything wrong with the first example.
>>
>using ifs without elses.
Is this a bad practice?
>>
>book introduced me to gets
Why would I ever use scanf if I only need one string?
>>
>>62449335
wondering this as well
>>
File: ajsdad.png (2KB, 339x76px) Image search: [Google]
ajsdad.png
2KB, 339x76px
what am i supposed to do here for multiple children? noob here
>>
>tfw there is one dev on the team who just can't wrap his head around git branches, merging, etc
>but he has decades of domain experience, so we just let him do things directly in master
>>
>>62449297
>The argument is that because these absurd examples also logically make sense, that practical examples are just as absurd.
Again, I wasn't making any argument. Just illustrating that your """argument""" is a complete and utter non-sequitur.
>>
>>62449335
You have else, you just fall through.
>>
>>62449376
Do you want to apply the rule for elements that satisfy either of those or only ones that satisfy both?
>>
>>62449379
What? Why?
git branches are fucking trivial. That dev cannot be competent if s?he can not understand branches in git.
>>
>>62449407
Satisfy both
>>
 const time
>>
>>62449383
No, you're arguing that it's a non-sequitur and you're wrong.
>>
>>62449414
Delete the whole block because nothing can ever satisfy both of those
>>
>>62449394

Is that a bad practice then?
>>
>>62449437
Figured
I'll just copy it into a different bracket thingy
thanks anyways
>>
>>62449435
No point explaining to a subhuman why its "arguments" aren't arguments. It won't get it.
>>
Is it worth it to learn assembly in this day and age?
>>
>>62449510
yes if you want to write really small programs or work with jit compilers
>>
>>62449510
>Is it worth it to learn assembly in this day and age?
Does the average programmer ever need to care about assembly to get the job done properly? No. Will you benefit from learning assembly? Who knows. What's your endgame?
>>
>>62449563
Banging bitches
>>
>>62449501
His arguments are arguments though, they're just wrong and he clearly doesn't know what a non-sequitur even is.
>>
>>62449510
Yes. It's still a great choice for embedded systems, fun/useful for x86 and required if you want to step your game up and write a fucking compiler.
>>
>>62449584
I was talking about you, though. Not only do you not know what a non-sequitur is, you clearly don't know what an argument is, because you can't tell one apart from a statement.
Here's what your entire position is based on:
>int *i; is appropriate because it describes what happens when you dereference 'i' (you get an int), and from this you can deduce that the type of 'i' is a pointer to an int
There's no logical connection between describing what happens when you dereference 'i' and being the appropriate way to define 'i'. It's a non-sequitur. (Protip: that was a statement of fact, not an argument)
>>
>>62446298
and you don't seem to understand
a shame you seemed an honest man
>>
>>62449603
LLVM sweaty
>>
>>62449635
>hurhur it's a statement not an argument
fuck you are so stupid
>>
File: 1504642852106.gif (930KB, 640x480px) Image search: [Google]
1504642852106.gif
930KB, 640x480px
Are BASICs dead now?
>>
>>62449603
>Yes. It's still a great choice for embedded systems
Nobody does full-on assembly for embedded systems anymore.
At most you're doing a few short functions if you're doing something that's too low for C to handle.

That said, being able to read and understand assembly is still important.
>>
>>62449710
Shoo, monkey. You're not allowed to speak here.
>>
>>62449435
>>62449501

Guys, stop arguing. Let's decide this once and for all:

K&R use:
char *p;


"The Practice of Programming" by Rub Pike and Ken Thomson uses:
char *s;


Ken Thomson uses:
char *c;


See:
>https://www.win.tue.nl/~aeb/linux/hh/thompson/trust.html


Bjarne Stroustrup says:

>A "typical C programmer" writes "int *p;" and explains it "*p is what is the int" emphasizing syntax, and may point to the C (and C++) declaration grammar to argue for the correctness of the style. Indeed, the * binds to the name p in the grammar.
>A "typical C++ programmer" writes "int* p;" and explains it "p is a pointer to an int" emphasizing type. Indeed the type of p is int*. I clearly prefer that emphasis and see it as important for using the more advanced parts of C++ well.

See:
>http://www.stroustrup.com/bs_faq2.html#whitespace


So Kernighan, Ritchie, Thomson and Pike all use the same notation. Makes you think, doesn't it?

I guess waht I'm trying to say is that if you write "char* s;" you are one big contrarian faggot and should not programm in C. Programm in C++ or even in Java. But leave C alone.

Thanks for listening.
>>
>>62449448
Depends on what your coding standard is. Personally, I always use the else unless its a check. For example, if x is less than 10, I put the else in. If malloc returns NULL I don't have an else.
>>
>>62449829
Nobody's saying that you shouldn't write C that way, the argument is that the grammar of C should not have been specified that way.
>>
>>62449635
>Not only do you not know what a non-sequitur is, you clearly don't know what an argument is, because you can't tell one apart from a statement.

You can't argue a topic for a dozen posts and claim you weren't arguing.

>There's no logical connection between describing what happens when you dereference 'i' and being the appropriate way to define 'i'. It's a non-sequitur.

It's not a non-sequitur because it's a subjective matter, not a matter of logic.

Logically there is no denying that
int *i;
makes sense. Whether or not it's how things should be done is subjective.

>(Protip: that was a statement of fact, not an argument)

Actually it's a argument framed as a statement, and an incorrect one.
>>
>>62449829

Sorry, "The Practice of Programming" is by Pike and Kernighan.
My point still stands, though.
>>
>>62449829
Please remake this post but with a cute anime girl
>>
>>62449875

But "what if C was C++" is not an interesting argument.

The Linux Kernel coding style says:
"When declaring pointer data or a function that returns a pointer type, the preferred use of * is adjacent to the data name or function name and not adjacent to the type name. Examples:
char *linux_banner;
unsigned long long memparse(char *ptr, char **retptr);
char *match_strdup(substring_t *s);
"


Basically EVERYBODY who counts something in the C universe does and says the same thing.

C, motherfucker.
Do you speak it?
>>
>>62449875
I agree, it should be p: *T.
>>
>>62449877
Okay, you're just demonstrating once again that you're a double-digit-IQ monkey.
>>
>>62449928
You shouldn't do it in C++ either, because that uses the same grammar for declaration.

Can you think of a single language besides C, and those languages which maintain some kind of source compatibility like C++, which use this ass-backward type specification?
>>
File: 1405969283468.gif (140KB, 600x450px) Image search: [Google]
1405969283468.gif
140KB, 600x450px
Why won't this function call work?
#include <stdio.h>

void print(char plz);

int main()
{
char plz[] = "help";

print(plz);

return 0;
}

void
print(char plz)
{
printf("%s", plz);
}
>>
>>62450024
You need to take a char pointer, not a char.
print(char *plz)
>>
>>62450033
Thanks, I though all arrays are pointers already
>>
>>62449977
I'm impressed how you consistently lower the bar for your arguments.
>>
>>62450055
Arrays will decay into pointers, but they are not exactly the same thing.
However, your function just takes a single char. It's not an array or a pointer.
>>
>>62450055
That's irrelevant. Your function just asks for a single char, not a pointer to a bunch of chars.
>>
File: animuh.png (769KB, 1052x1342px) Image search: [Google]
animuh.png
769KB, 1052x1342px
>>62449881

Some people ask themselves which is correct?
char* s;


or
char *s;



Let's see:

K&R ("The C programming langauge") uses:
char *s;


"The Practice of Programming" by Pike and Kernighan uses:
char *s;


Ken Thomson (i.e. "Reflections on Trusting Trust") uses:
char *c;


Bjarne Stroustrup says:

>A "typical C programmer" writes "int *p;" and explains it "*p is what is the int" emphasizing syntax, and may point to the C (and C++) declaration grammar to argue for the correctness of the style. Indeed, the * binds to the name p in the grammar.
>A "typical C++ programmer" writes "int* p;" and explains it "p is a pointer to an int" emphasizing type. Indeed the type of p is int*. I clearly prefer that emphasis and see it as important for using the more advanced parts of C++ well.

See:
>http://www.stroustrup.com/bs_faq2.html#whitespace


The Linux Kernel coding style says:
>When declaring pointer data or a function that returns a pointer type, the preferred use of * is adjacent to the data name or function name and not adjacent to the type name. Examples:
char *linux_banner;
unsigned long long memparse(char *ptr, char **retptr);
char *match_strdup(substring_t *s);



What does this tell us?
Kernighan, Ritchie, Pike, Thomson, Stroustrup, Torvalds..
Basically EVERYBODY who counts something in the C universe does and says the same thing.

If you keep on using
char* s;
you are one big contrarian faggot and should not programm in C.

Go ahead, programm in C++.
Or even in Java.

But leave C alone.
>>
File: 3423332123.png (129KB, 500x522px) Image search: [Google]
3423332123.png
129KB, 500x522px
>mfw coworker takes programming advice from /dpt/
>>
File: 4011.png (11KB, 367x181px) Image search: [Google]
4011.png
11KB, 367x181px
I just added password protection to some shitty chat site.
>>
template <typename T>
using type = T;

type<char*> str1, str2;
>>
File: 1503687807072.jpg (110KB, 914x892px) Image search: [Google]
1503687807072.jpg
110KB, 914x892px
>>62450104
>not taking advice form /dpt/
>>
Do people still unironocally use OOP for actual projects?
>>
File: whatevereggs.jpg (43KB, 345x396px) Image search: [Google]
whatevereggs.jpg
43KB, 345x396px
>>62450161
They do
>>
>>62446723
Are you unironically 12?
>>
>>62450161
With a larger codebase, it helps a lot with structuring it well.
Just don't go full ENTERPRISE QUALITY, and it's fine.
>>
>>62450075
I don't need to make any arguments. I can just dismiss your claim on the basis that it's your arbitrary and subjective opinion, and on your inability to provide any logical justification for it. Calling you a retard is literally enough in your case.
>>
>>62447229
unironically the best post i've ever seen on /g/
>>
File: wat.jpg (47KB, 640x454px) Image search: [Google]
wat.jpg
47KB, 640x454px
>>62450161
Can you provide an unironic alternative for it?
>>
>>62449829
i like bjarne's argument there so i write int* p
>>62450091
>you are one big contrarian faggot and should not programm in C.
try to stop me
>>
>>62450161
Are you a NEET, a student with no actual work experience, or in embedded systems? I can't think of any other circumstances under which you could even consider this a real question.
>>
>>62450255
Procedural programming, dingus.
>>
Why do the people posting in /dpt/ get worse every year?

A few years ago there was people working on actual shit with actual value.

Last year people were barely literate in any programming language.

Today I don't even know what this shitfest is supposed to be.

> But everyone still argues the same "OOP that, Functional programming this" arguments.
> Except now nobody even has a remote idea what they're talking about

/dpt/ used to be inspirational. Fuck you guys.
>>
>>62450255
Procedural with the right bits of functional.
>>
>>62450260
>oop
>embedded systems

Try harder CIA nigger.
>>
>>62450319
You can have OOP in C, Pajeet.
>>
>>62450091
char *s, t;

What's the type of t?
K&R are _right_.
>>
File: 1502894681008.gif (66KB, 350x350px) Image search: [Google]
1502894681008.gif
66KB, 350x350px
>>62450294
>>
File: autistic anime girl.jpg (66KB, 893x960px) Image search: [Google]
autistic anime girl.jpg
66KB, 893x960px
>>62450294
I have a crush on someone with the initials RD.
>>
>>62450336
You mean polymorphism, reuse, all the good bits of OOP? I already do use them, I just don't call it OOP.
Function pointers alone already provide 90% of what classes were made for.
>>
>>62450375
>polymorphism, reuse
Neither of those is exclusive to POO.
>good bits of OOP
That's an oxymoron.
>>
>>62450261
>>62450301
>Procedural programming, dingus.
>Procedural with the right bits of functional.
Hey, guess what? In the end of the day you're still going to have bundles of state that coincide with the entities of the problem domain, and these bundles of state are still going to have some internal invariants that you're going to want to maintain somehow, and you're still going to have functions associated with these bundles of state, so what exactly do you hope to achieve by doing effectively the same thing OOP does while calling your program "procedural"?
>>
>>62450390
OOP is about the decomposition of your (entire) program into objects, and your program is modelled as objects passing messages to each other.
It's not just some fancy function call syntax.
>>
>>62450294
When I last spent any real time on /dpt/, it was transitioning from 'Haskell is the only language that matters' to 'JavaScript everywhere'. It take it OOP vs functional is the current holy war?
>>
>>62450294
because /prog/ got deleted
>>
>>62450390
Why do you keep assuming that data and functions must be so tightly coupled?
Minimizing variable state should be a priority. That alone reduces and sometimes even removes the need for encapsulation.
Pure functions are much more predictable, easier to test and prove correct and way more reusable than a bloated class. Design your data structures accordingly, and suddenly you realize that OOP is not always the answer.
>>
>>62450434
That was VIP quality!
>>
>>62450231
>I can just dismiss your claim on the basis that it's your arbitrary and subjective opinion

Ditto.
>>
>>62450294
4chan as a whole has always been shit.
>he gets attached to an anime board
>>
>>62446298
Logistics and fulfillment module for a medical supply house. Currently serving 70k patients in 22 states. Working to replace a horrid contraption of inherited C, FoxPro, AlphaFive and BATCH that communicates via CSV files and text file flags.
>>
File: Country_1dd231_5746456.jpg (62KB, 680x449px) Image search: [Google]
Country_1dd231_5746456.jpg
62KB, 680x449px
>>62450434
>>62450469
>>62450294

>tfw Russian
>2ch has entire board dedicated to programming
>came here to shitpost and practice English
>>
>>62450414
>OOP is about the decomposition of your (entire) program into objects
So if not every single thing in my program is modeled by an object, it's not OOP anymore?

>objects passing messages to each other
>It's not just some fancy function call syntax
object.method(arg1, arg2, ..., argn) represent that adequately enough in most cases, and the same can be done using a plain function. It's a syntactic difference, not a semantic one.
>>
>>62450447
>Why do you keep assuming that data and functions must be so tightly coupled?
Why do you keep lying?

>Minimizing variable state should be a priority.
What are you going to do, wish it all away?
>>
>>62450643
>So if not every single thing in my program is modeled by an object, it's not OOP anymore?
OOP isn't even that well defined, and modern uses of it are all over the fucking place.
I was using a more classical definition of it.
>It's a syntactic difference, not a semantic one.
That's exactly my point. Syntax shit is not a new "programming paradigm".

Here's a nice video to watch if you have some free time: https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>62450461
From the very beginning, I was merely pointing out that your "justification" for breaking the usual pattern of type descriptor followed by the variable names is baseless and subjective. That is all. I don't know why I even made the mistake of trying to interpret your arbitrary spewing of opinions as an attempt at a logical argument.
>>
>>62450669
>lying
Alright, now you are trolling.
>>
>>62450718
>I don't know why I even made the mistake of trying to interpret your arbitrary spewing of opinions as an attempt at a logical argument.

Because you're a dumbass who can't tell the difference, probably.
>>
>>62450686
>OOP isn't even that well defined
And yet here you are, arguing against it?

>I was using a more classical definition of it.
I don't see any actual definition provided by you, but feel free to fix that in your next post.

>Syntax shit is not a new "programming paradigm".
You're the one obsessing over syntactic differences. I'm talking to you about semantic ones.

>that video
Yes, I've seen it before and I knew you were going to parrot precisely that trash.
>>
>>62450720
>now you are trolling.
Really? Then show me where I said that functions and data "must" be "so tightly coupled".
>>
>>62450741
>I don't see any actual definition provided by you, but feel free to fix that in your next post.
>>OOP is about the decomposition of your (entire) program into objects, and your program is modelled as objects passing messages to each other.
>>
>>62450255
Objects are fine when they're the appropriate abstraction, which is not as often as object oriented programming would have you believe.
>>
>>62450643
>It's a syntactic difference, not a semantic one.
T H I S
H
I
S

In fact one of the things I like about Python that emphasizes it is that you can call a method on an object as obj.f(arg0, arg1) OR classname.f(obj, arg0, arg1) with no different end result. This is particularly useful when assigning a member function to a variable and you want to call it on different objects during runtime.

But the same can be obtained in C by using a plain function and passing a different struct each time. Same meaning. OOP most of the time is just new syntax for global functions. Visualizing it as "objects exchanging messages" is simply a way to visualize it. Others may mentally picture the same program in a different way
>>
>>62450756
>uhhh it's about objects that pass messages
That's not a definition.

>literally everything has to be an object
Is that what you're arguing against? Because I have no interest in defending that position.
>>
>>62450801
>That's not a definition.
Yes it is.
>Because I have no interest in defending that position
That's what "true OOP" is though, fuckboi.
Why don't you try present your special snowflake definition of OOP which doesn't include imperative programming in it?
>>
>>62450827
>imperative programming
procedural programming*
OOP is actually imperative.
>>
>>62450390
>>62450447

Differnt problems, different tools..


>Hey guyz, I programm a game. I need to have many different states at the same time. I also don't know what those states exactly are, they will probably be somehow related and it will probably change a few times..

Cool, take OOP!
Haing many differnt states is a breeze, you can always add stuff without doing complicated things with types. Just hide your information in those objects and let them communicate!


>Wazzup, I programm a huge program which does a lot of I/O and concurrency. The data structures are pretty clear, but we often change the way we evaluate them and the operations on the data structure. How to not turn this into a complicated mess?

Functional programming is for you! The usage of immutable values brings great joy to those who have to do a lot of data operations and especially often at the same time. Also defining new operations on teh fixed data structures is easy peasy lemon sqeezy, you don't need to change the classes/interfaces, just add the operation and you're fine!
>>
>>62450792
I don't think you understood my point at all. What I'm saying is that it doesn't matter what syntax you use to simulate message passing (or if you have any special syntax for it at all). What matters is associations on the semantic level.
>>
>>62450848
>I programm a huge program which does a lot of I/O
>functional programming is for you
is this true?
>>
>>62450848
>polymorphism requires OOP
>>
>>62450827
>Yes it is.
You can call it a definition, but it isn't particularly concrete or useful.

>Why don't you try present your special snowflake definition of OOP
Because I'm not the one arguing against "OOP", you were. If you were merely arguing against the idea that everything must be an object, I don't really care. I don't think everything must be an object either.
>>
>>62450755
>Hey, guess what? In the end of the day you're still going to have bundles of state that coincide with the entities of the problem domain, and these bundles of state are still going to have some internal invariants that you're going to want to maintain somehow, and you're still going to have functions associated with these bundles of state
>>
>>62450854
That's simply how you see it, as I said. Not everyone thinks in the same way.
>>
>>62450864

Erlang, Elm, Scala, Clojure..

They are all great for concurrency because of dat.
>>
>>62450848
>Differnt problems, different tools..
I actually agree with this. I'm not the one arguing that OOP should always be used. Just pointing out that trying to throw it out entirely won't really work, because for some tasks you will end up basically emulating it by other means.
>>
>>62450896
>but it isn't particularly concrete or useful
I know it's not concrete. Most definitions of this sort of shit aren't. I need to be able to consider smalltalk as well as Java in the same definition. "Message" is more general than "function call on an object".
>>
>>62450899
Okay, and what part of it do you think implies that functions must be coupled to data in principle?
>>
>>62450865

That's not the point..

But changing data structures is not comfy in functional programming. Since the data sturctures are the same for everyone, you have to do a lot of changes here (every method that works with those structures).

In OOP you just add one more data field in the objects or make a new class - who cares? The data are hidden inside the objects..
>>
>>62450945
>"Message" is more general than "function call on an object".
Sure. "Function call on an object" is just one way to simulate message-passing, and it doesn't matter if you have a special dot syntax for it or not. What matters is the intent behind it, which will usually be reflected by the overall design of the program and not any particular function call.
>>
It's 2017 and we still have people arguing for days about whether sticking functions in a struct with an implicit pointer to the struct is good or bad.

It doesn't fucking matter you monkeys. Do whatever allows you to actually write something that's easy to understand and that works. Mongoloids.
>>
>>62451154
>t. retard
>>
what's a good networks related project that can be done in Lisp?
>>
>>62451175
I made a simple email client using the usocket library for sockets. Common Lisp is ultra comfy for that.
>>
File: 1404020896660.jpg (59KB, 421x500px) Image search: [Google]
1404020896660.jpg
59KB, 421x500px
The palms of my hands are read and tingly.
What does it mean?
>>
>>62451224
eat healthier and improve your circulation.
>>
>>62451192
I kinda want to do something more advanced, but thanks for the suggestion
>>
>>62451175
IRC daemon
>>
>>62451370
The IRC protocol sucks
>>
>>62450945
>message is more general than function call on an object
Don't think that's a good view. It's an entirely different set of constraints. A function call on an object in OOP should either be a message or an internal procedure to the class.
A message is a function call on an object that only passes non-rererential data (so any information meant to represent external states are forbidden, you can pass your circle a new radius. You can't pass your circle a new object to follow/keep a bounding box around.

This is required to fulfill encapsulation in OOP. It is not an easy task. And I do have complaints about it. But there's no denying that ignoring the programmer effort and performance concerns (that could probably be alleviated using a sufficient compiler, not that I've read papers on this) it's a very nice system. States remain separate in a stateful program and would fulfill the run-time requirements of the world model.
>>
>>62451403
It's very simple. I'm pretty sure that's why anon recommended it.
>that can be done in lisp
Anything that's not exclusively low level. Which is very few things. You could write a virtual cross platform network driver in lisp.
>>
File: 1490293812688.jpg (95KB, 244x260px) Image search: [Google]
1490293812688.jpg
95KB, 244x260px
Rate my code, /dpt/
RANDOMIZE TIMER
main_loop:

CLS
A = INT(RND * 100)
B = INT(RND * 100)
ANSWER = A * B
PRINT "What does "; STR$(A); " * "; STR$(B); " equal to? Type Q to quit."
INPUT C$
IF (C$ = "Q") OR (C$ = "q") GOTO stop_program
IF VAL(C$) = ANSWER THEN PRINT "Correct!" ELSE PRINT "Wrong! The answer is "; STR$(ANSWER)
PRINT "Press any key."
DO: K$ = INKEY$: LOOP UNTIL K$ <> ""

GOTO main_loop

stop_program:
END
>>
>>62451461
>It's very simple
The RFC is vague, often arbitrary, and frequently contradicts itself. No ircd in popular use actually follows the RFC because it would make the ircd nearly unusable
>>
File: 1456643683672.jpg (520KB, 591x921px) Image search: [Google]
1456643683672.jpg
520KB, 591x921px
>>62446298
Hey /dpt/

I was asking about this like a month ago. Until now I've been an animator, that's been an unstable career for me, so I've been exploring either changing discipline within the game industry or completely changing careers. Changing to a technical art role could be done by knowing Python.

So I've done some basic introductory things with Python recently and have done some basic coding in the past. My main question is if I can just "learn Python" and then be prepared to take on many different jobs. Or would I have to keep drilling down, learning deep shit for each new kind of role I'd qualify for?

I picked up these three courses during their last sale and wonder if there's a reason you'd recommend starting with one of them in particular? Does one look like it gives a better path to a job than the other? Will learning something related to what I know (Maya, animation) be a better place to start and then branch out from, or should I be building a core from the ground up?

https://www.udemy.com/complete-python-bootcamp/ (13 hours)
https://www.udemy.com/python-the-complete-python-developer-course/ (40 hours)
https://www.udemy.com/python-for-maya/ (related to current career path/ industry)

Thanks bros. This is a really rough patch for me that's been hard to lift out of, so I need a lot of guidance.
>>
What programming can I do on just a stock windows PC without anything downloaded? I noticed Batch and VBS are available. Is there anything else available?
>>
File: 1358667167651.gif (284KB, 267x200px) Image search: [Google]
1358667167651.gif
284KB, 267x200px
>>62451506
>technical art
>>
>>62451529
JavaScript
>>
>>62451529
bash if it's windows 10 I think
>>
>>62451561
The Windows Subsystem for Linux isn't preinstalled
>>
>>62451529
If you have WSL on 10 which it sounds like you do, it should come with gcc I think
>>
>>62451461
>Anything that's not exclusively low level. Which is very few things.
You can do low-level things in CL quite easily through the C FFI.
>>
>>62451497
>rfc
If it's bad why would you use it?
>>
>>62451571
ah ok, I thought it was
>>
>>62451549
How do I run JavaScript? In a browser? If I save a file as .js, is there something the pc can run it from?

>>62451561
I will look into bash, thanks anon!
>>
>>62451579
And you still consider yourself writing a lisp program?
I'm not saying you're wrong it's just not how I'd see it.
>>
>>62451579
Call me when it's going to have Rust FFI
>>
>>62451583
Because it defines what the IRC protocol is and is the only way to guarantee interoperability with other standards-conforming software. You don't have to follow it, but then you aren't actually implementing IRC, just something similar to it
>>
>>62451573
Thanks anon, will look into this!
>>
>>62451608
>is there something the pc can run it from?
Yes, you have Internet Explorer.
>bash
Bash is a part of WSL
>>
>>62451609
I don't know how to use the C FFI in CL but if you can abstract it then why not? It's a mix of lisp and C but you can end up writing low level lisp
>>
>>62451506
check this out, I found it pretty cool
http://baku89.com/work/ffff

as always, learn your basic programming principles, and everything will be an application of that so you can pick things up fast. I don't think I can help you decide on what course (if you insist on using those) or what direction to go in since it really depends on the person.

Your end goal should be to learn programming principles, and then everything else will be an application of that. Now you could learn it top-down (starting abstract and then moving to practical) or bottom-up (starting with practical and moving to abstract) which is basically your question. The thing is, it really depends on the person, sometimes generalizing something you already know makes it really clear, but sometimes it doesn't. In the end, you have to make the decision. Maybe try both and see what you like?
>>
>>62451609
>And you still consider yourself writing a lisp program?
You're no longer dealing with pure lisp primitives, but you still have the power and flexibility of lisp at your disposal, which is pretty useful for all the plumbing.
>>
File: fox.png (78KB, 980x740px) Image search: [Google]
fox.png
78KB, 980x740px
>>62451542
Not sure what that gif means but technical art roles are like setting up characters for animation and other tools for artists to use.

Not like programming art in to existence via technical means.
>>
>>62451679
that's pretty neat.

yeah thanks though. I guess I'll try some intro lessons in the Maya one and see what I get out of them.

I've got links to free resources too but I was looking at paid things because maybe they'll give structure for a little longer than a menagerie of free. But I don't insist on udemy at all, just already picked those guys up.
>>
>>62447473
>>62447473

But you're wrong, it doesn't break the consistency of the specifier coming before the declarator because it isn't a specifier. A pointer isn't even a data type, and *shouldn't* be part of the type specifier because it isn't a type and doesn't actually behave like one. Sure, the C standard never exactly defines the term "data type", but the pointer is pretty unique in its behavior and should never be treated by anyone as a type, particularly not a compiler. It is better to simply say that pointers are pointers and they're therefore not part of the specifier-qualifier list.
>>
>>62451997
This entire post is pulled out of your ass. int* is its own type as far as the C type system is concerned.
>>
>>62447473
>>62451997

>and that variable has the type int*

And this is the source of your confusion. A pointer is a *pointer* and it *points* to an int type. It is not of type of pointer to int, it's a pointer to type of int.
>>
>>62452035
>It is not of type of pointer to int
You're pulling that statement straight out of your ass. int* is precisely the type of the variable.
>>
File: 1501130028535.png (75KB, 1229x417px) Image search: [Google]
1501130028535.png
75KB, 1229x417px
>>62450294
>>
C++ question.

struct Foo{
int x=0;
};

struct Proxy{
Foo *f;

Foo* operator->(){
return f;
}
};
struct Proxy2{
Foo *f;

Foo* operator->(){
return f;
}
};
struct Stupid : Proxy, Proxy2{

};

Stupid stupid;


How could I utilize the overloaded -> operators? From my understanding operators are supposed to work like methods but the typical syntax
stupid.Proxy::->x;
doesn't work.

I'm aware this is dumb I just want to know for the sake of better understanding the language.
>>
>>62452052
>>62452029

No, using the distinctions of "pointer to type of int" and "type of pointer to int" one would have a few expectations. A type of pointer to type could not:

* Point to functions
* Be void pointers
* Be reinterpreted without type conversions
* Be part of the specifier-qualifier list

if one must define a pointer as a type then it would at least be its *own* type and NOT type of pointer to int. The C standard says this itself:

>— A pointer type may be derived from a function type or an object type, called the
>referenced type. A pointer type describes an object whose value provides a reference
>to an entity of the referenced type. A pointer type derived from the referenced type T
>is sometimes called ‘‘pointer to T’’. The construction of a pointer type from a
>referenced type is called ‘‘pointer type derivation’’. A pointer type is a complete
>object type.

In other fucking words: It's not type of pointer to int, it's pointer to type of int and that's why it's not in the specifier-qualifier list.
>>
I just learned JS and NodeJS and trying to make a website but it's not really working out. First time I've actually programmed anything of merit so I guess it's pretty cool.
>>
>>62452269
>>62452052

>* Be part of the specifier-qualifier list

Sorry, I mean:

>* Not be part of the specifier-qualifier list
>>
>>62452269
Did you actually read the piece of the C standard you're quoting? Because it literally explains what a pointer type is and how it's derived from an object type. According to your braindamaged logic, variables that are pointers "don't have a type". They're just "pointers", which makes them magically different in a way that doesn't manifest itself outside of your tiny mind.
>>
File: lain stare.jpg (28KB, 720x480px) Image search: [Google]
lain stare.jpg
28KB, 720x480px
>>62449683
and all the fears you hold so dear
will turn to whisper in your ear
>>
ok boys, i want to learn new language
i know c/c++, java, php and js
im thinking about python and go
I would like to use it for APIs and other web stuff
Not like building desktop apps etc

So, what should i pick?
>>
>>62452347

>Did you actually read the piece of the C standard you're quoting?

Yes, and it says "A pointer type is a complete object type", and all the integer types are also "complete object types" according to the standard itself.
>>
File: 1501855791315.gif (18KB, 340x340px) Image search: [Google]
1501855791315.gif
18KB, 340x340px
>>62452277
>JS
>merit
>>
New thread:

>>62452398
>>62452398
>>
File: 1496998730043.jpg (33KB, 493x386px) Image search: [Google]
1496998730043.jpg
33KB, 493x386px
>>62452377
>a pointer type is a complete object type
>an int is also a complete object type
>this proves that a pointer type is not a type
>also, since both are complete object types, they're clearly inherently different
Please make it stop.
>>
>>62452154
my guess is
((Proxy) stupid)->x
>>
>>62452154
stupid.Proxy::operator->()->x
>>
>>62452425

>if one must define a pointer as a type then it would at least be its *own* type and NOT type of pointer to int.

I'm not saying they are inherently different to other types, but I'm saying they're pointers independent of other types.

For example, they're different in that arithmetic types would trigger type conversions when casted while a pointer cast would just reinterpret the data as something else, meaning that the pointer is agnostic to a type unless you specifically ask the compiler not to be (int *a), which is why "void *ptr" works. Additionally any other type can't interact with functions the way a pointer does.

Whether a pointer is a type or not is a relatively meaningless discussion given how the C standard never defines a data type, but "int *a" is *not* "type of pointer to int".
>>
>>62452611
>I'm not saying they are inherently different to other types
You were saying that they are not types at all just a few posts ago. Now you're saying that they are types, and not inherently different from other types.

>but I'm saying they're pointers independent of other types
The bit of the C standard you quoted clearly states that they are derived from other types, so they're not "just pointers".

>Whether a pointer is a type or not is a relatively meaningless discussion given how the C standard never defines a data type
Given that the C specifically defines pointer types and how they are derived, I don't see how it's up for debate that pointer types are types, so I'm moving on from your asinine bullshit.
>>
Could a country embrace crypto as their official legal tender?
>>
>>62452404
Become my mentor if you wanna laugh at me, if not then begone otaku dweeb
Thread posts: 321
Thread images: 29


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