[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 18
File: beyond-fizzbuzz.jpg (33 KB, 381x499) Image search: [Google]
beyond-fizzbuzz.jpg
33 KB, 381x499
Old thread at >>51412882

The "I don't know C but I try really hard" edition

void float_as_u(float f, unsigned *u)
{
if (sizeof f != sizeof *u) {
abort();
}
memcpy(u, &f, sizeof *u);
}

int test(void)
{
float f = 1;
unsigned u, *p = malloc(sizeof *p);
if (!p) {
abort();
}
float_as_u(f, &u);
float_as_u(f, p);
printf("u = %u\n", u);
printf("*p = %u\n", *p);
free(p);
}
>>
D.
>>
first
>>
First.
>>
Can anyone provide a detailed tutorial about breaking out of loops? They seem to have me stumpt.
>>
What is the most complicated/largest program written in Python?

I just want to know if its babby language or is serious business.
>>
What is best resource for learning Python
>>
>>51421190
>Can anyone provide a detailed tutorial about breaking out of loops?

break;
>>
>>51421190
first
>>
>>51421196
theano
>>
>>51421244
Can you dumb it down a notch?
>>
>>51421139
Daily reminder that '[...] SEXP-Syntax is neither sufficient nor necessary' for a language to qualify as Lisp. Sources: C2.com. LispFamily wiki-article C2.com/LispFamily (accessed 19th November 2015), McCarthy, J. (1960). LISP 1.5 Programmers' Manual (The MIT Press) doi>10.1145/359545.359566

Valutron is my my project to build a Lisp that provides an alternative syntax, known as V-expressions, for code. S-expressions are still usable, as the core is in fact a typical Lisp interpreter that passes code through the same stages. The V-expressions are implemented with what is essentially a reader macro. V-expressions support macros with a similar expressivity to Scheme's syntax-rules, as well as reader macros.

Valutron draws mainly upon Common Lisp for inspiration, with some degree of Scheme ideals. It implements an object model which is similar to CLOS, with some SmallTalk characteristics.

The emphasis upon VOM (the Valutron Object Model) and V-expressions are what set Valutron apart from other Lisps.
>>
>>51421196
https://en.wikipedia.org/wiki/List_of_Python_software#Applications
>>
>>51421272
#define b break;
b
>>
>>51421281
>stillborn
>>
>>51421190
>People who cant read a question
Its cool. I've confirmed what I want to do isn't possible.
>>
>>51421281
>c2.com
>source
c2.com is more like an anti-source: anything said there is the opposite of reality.
>>
>>51421290
Still not following. Please explain thoroughly!
>>
>>51421296
lmbo
>>
>>51421281
Vom? More like vomit am i rite?
>>
>>51421196
openstack would be a good candidate
http://git.openstack.org/cgit/

django is quite big too

quartz from bank of america is know to have +10 000 000 lines of code.
>>
>>51421155
Thanks m8
>>
>>51421281
>c2
as credible as suckless
>>
>>51421303
>>51421343
c2 is way more relevant than /dpt/ or wikipedia.
>>
>>51421309
A b c d e f g, h i j k l m n o p. Q r s, t u v, w x, y and z; Now, you know your ABCs, Next time, won't you sing with me?
>>
>>51421345
c2 is about as reliable as oracle software.
>>
>>51421345
>c2 more relevant than wikipedia
lol k
>>
File: screen.png (135 KB, 1024x768) Image search: [Google]
screen.png
135 KB, 1024x768
>>51420421
So, I made the colorscheme generator fall back to search for the nearest color to the terminal color if it doesn't find any that match the terminal color normally. I still feel like the colors are too close to the original colorscheme, but at least the program is operational now.
>>
File: yamadera.png (1 MB, 1024x768) Image search: [Google]
yamadera.png
1 MB, 1024x768
>>51421426
And the image the scheme was generated from, for reference.
>>
File: fp.png (771 KB, 862x812) Image search: [Google]
fp.png
771 KB, 862x812
hey all

https://storify.com/realtalktech/why-functional-programming-sucks

ive been doing some haskell tutorials from learnyouahaskell

any recommendations on other haskell books?

im thinking about asking my boss if we can go full haskell at our next startup. anyone know some successful business cases?

here is a list of what i have:

- facebook (all backend tech)
- john cartwright (mentioned it at a conference)
- pandoc

there is likely many more, but the issue is haskell programmers are humble so don't feel the need to brag - they're too busy focusing on coding
>>
>>51421477
>>>/reddit/
>>
>>51421139
any concurrent programmers in here?

In specific semaphores? They have me stumped right now.
>>
File: screen.png (394 KB, 1024x768) Image search: [Google]
screen.png
394 KB, 1024x768
>>51421426
>>51421472
And another result.
>>
>>51421477
>haskell programmers are humble so don't feel the need to brag

I always had the impression that haskell programmers are the vegans of the coding community.
>>
>>51421477
ocaml has plenty of success stories in industry, unlike hasklel.
>>
>>51421487
you're being glib and not thinking about problems deeply. you dont need to worry about semaphores to begin with

you don't need semaphores if you're using Haskell.

if you really are not smart enough to program haskell - you have a toy language called go.

it was made for special people like you not enlightened enough to grasp fp concepts
>>
>>51421487
What exactly is stumping you? Imagine a clerk at a lazer tag place who hands out the guns. He only has N guns. If you come to play lazer tag and he has a gun available, you can play right away, but if there are N people already playing lazer tag, you'll have to wait until one of them is done playing before you can get your gun and start playing lazer tag. This ensures that there are never too many people in the lazer tag arena at once.

In this metaphor, the clerk is a semaphor, the guns are permits, the players (including those who are waiting to play) are concurrent processes, and the arena is a resource.

In this metaphor, the clerk is the semaphore
>>
>>51421559
https://wiki.haskell.org/Haskell_in_industry

swiss banks are moving from ocaml to haskell due to parallel computing limitation of ocaml (still no parallel multi threading)
>>
have you ever wondered why golang has a bunch of cartoon beavers for a logo?

because no one takes them seriously

if you can't understand fp - you're going to be treated like a child.

and you deserve it - because anyone who is legitimate knows fp.

>>51421585
thank you.

google, ibm, boeing, etc.

Haskell is running everything that matters. Full stack.

if anyone here wants to hate on haskell, go back to reddit.
>>
>>51421139
Use the flint union you spastic.
>>
Does anyone know why the OP code has undefined behavior?
>>
>>51421603
>he fell for the meme
TOP KEK
>>
>>51421426
>red
brown
>yellow
brown

>>51421477
I found this to be extremely helpful: http://ptgmedia.pearsoncmg.com/images/9780131774292/samplepages/0131774298.pdf
>>
>>51421644
where's your header file?

where's your includes in the .c file?
>>
>>51421603
>because anyone who is legitimate knows fp
legitimate faggot that is
>Full stack
hahahaha, the full stack meme
>>
>>51421642
because you're copying the bits of a float onto an unsigned's store.
>>
>>51421585
>https://storify.com/realtalktech/why-functional-programming-sucks
They'll probably regret it. Better to go from ocaml to F#.
>>
>>51421666
that's not undefined; copying with memcpy is ok
mate, do you even C?
>>
>>51421687
It's fine if you're retarded, just don't bother posting.
>>
>>51421700
why do you think memcpy is undefined behavior, anon?
>>
>>51421666
Wrong.
>>
>>51421666
there no such undefined behavior in the standard.
>>
>>51421666
>you're copying the bits
That's the purpose of memcpy, you dumb cunt!
>>
>>51421666
>i don't know what the fuck i'm talking about
>i'm a web developer
anon...
>>
>trying to make a graph out of data in ASP.NET MVC
@{
var db = Database.open("SQLServerConnectionString");
var data = db.Query("SELECT userIP, userCountry FROM user_stats");
var myChart = new Chart(width: 600, height: 400)
.AddTitle("Title")
.DataBindTable(dataSource: data, xField: "userIP")
.Write();
}

>'The name 'database does not exist in the current context'
WebMatrix is added. I can't find a solution online.
>>
>>51421281
>daily reminder that everything is a lisp because it's parsed into an AST during compilation!
please leave here for reddit where they'll upboat your amazing insight into programming

>yeah, those stupid parentheses am I right?
>They should all be replaced with tabs, semicolons, newlines, and ``end'' statements, then it'd be a good lisp!
>150000 thumbs up
>>
>reading about the purpose of (void)
ideone.com/HMrnd9
>>
>>51421824
upboat!
>>
>>51421744
> implying a function either is or isn't undefined behavior
> why do we even have those functions then?

Just for you sweetard :
printf("%d\n", 42);
printf("%d\n");

Learn the difference, it could save your li... wait what ? No, you're already doomed, now off yourself, the sooner, the better.
>>
>>51421345
this is saying nothing since wikipedia is a hive of sjw scum
>>
>>51421840
>discussion about memcpy
>presents printf
m8...
>>
>>51421840
thank you for confirming that you have mental issues.
>>
>>51421840
That has nothing to do with the code being talked about. Why do you insist on proving beyond any doubt that you're a moron?
>>
Functional programming would be better if it was more focused on using faster data structures like plain arrays, instead of slow as fuck linked lists.
>>
>>51421840
well, yeah? how about:
int a = 1;

there's no undefined behavior here, you ignorant fuck!
#rekt
>>
>>51421878
maybe you should learn functional programming mate
>>
>>51421854
not sure if trolling, or damage control, or retarded at this point. Again, off yourself, I won't bother explaining to you how beyond wrong you are, I mean do you understand illustrating with examples??? Failed kindergarten or what???

>>51421870
>>51421872
samefagging, right? If you're really >>51421744
please think about whether it seems, I dunno, trivially true, that some uses of memcpy lead to undefined behavior, while some don't, which is precisely the point of reading the standard and REASONING FFS!
>>
>>51421894
how about no
>>
>>51421899
>while some don't
Like the one in the shown code. Please quote the relevant part of the standard to support your claim, or just gtfo if you're too stupid to discuss C.
>>
>>51421899
see
>>51421892
>>
>>51421854
>i don't know what the fuck i'm talking about
>i'm a web developer
m9-chan...
>>
>>51421272
The break keyword is used to exit any enclosing loop immediately.

Most programmers use it to stop the computer from unnecessarily iterating (e.g. you're searching a list and you found what you were looking for. You don't need to keep searching)

Now my question is, why don't some language allow to use "return" in a void method? Isn't it beneficial to stop executing a method partway through occasionally?
>>
>>51421744
>>51421840
well, I was asking in context; let me rephrase so you understand this time: "why do you think memcpy is undefined behavior in the OP code?"
I wasn't referring to all possible uses of memcpy, just the way it's used in >>51421139
>>
>>51421969
>why don't some language allow to use "return" in a void method?

Which don't? It works in C#, works in Java, etc.
>>
>>51421666
The standard doesn't agree with you: it says it's ok to copy the bits of an object of type float into an object of type unsigned. Anything else?
>>
>>51421840
>picks on a technicality of how the question was phrased instead of the heart of the matter
>being this autistic
>>
>>51421994
The result is undefined you mong.
>>
>>51421965
>i'm a web developer
anon, please, the adults are talking!
>>
>>51422011
No. The standard says it's defined.
>>
>>51421563

I need a way to schedule clients and provide them a direct "client" area that includes documents created (images, photos, emails, facebook, video) and provides modular, extension functionality.

These clients may not be literate, so a single entry point would be preferred. If it could begin at a URL they navigate to and be customisable for each unique scenario based on factors like operating system, method of contact, age, etc that would totally solve my problem.

How do I do this in Haskell?
>>
>>51422011
[citation needed]
>>
>>51422011
>contradicts the standard
o-ok, a-anon...
>>
>>51421992
I just looked it up and you're right.

I could've sworn I've had a compiler complain about using return in a void.
>>
File: 1444929617186.jpg (182 KB, 1920x1080) Image search: [Google]
1444929617186.jpg
182 KB, 1920x1080
how do you do error handling in sepples while avoiding exceptions?
Return codes?
>>
>>51421936
The C standard doesn't provide a lot of guarantees on the representation of the data, so I think the abstract standard C machine would not know what to do. When you start posting things assuming 2s complement integers in there you get huge backlash, so do this : write down the IEE floating point representation of 1, then convert it to an unsigned value *assuming little-endiannes OMG OMG OMG OMG*, assert that the program is by definition going to print it and flee before the wave of angry autists hits you.
>>
>>51422058
>>51422045
>>51422031
Spotted the web developers.
>>
Reminder that if you can't extend the syntax of your language you might as well be using BASIC.
>>
>>51422071
Maybe you tried to return a value instead of just having the return keyword
>>
>>51421973
I actually thought you were one of those nonthinkers that assume that a particular function - strcpy, scanf, fgets, und so weiter - is unsafe no matter what the context is, so don't use it Rajeev, or you'll get fired and end up pooing in the streets... Well you already do ^^
>>
>>51422135
Heil hitler!
>>
http://www.youtube.com/watch?v=iKcWu0tsiZM
Why Mozilla got sjewed? Rust is good, but this hypocritical politeness in the "community" kills all.
>>
>>51422084
>abstract standard C machine would not know what to do
In this case, it does.
>assuming 2s complement
No such assumption is made.
>>
>>51421477
>com/realtalktech/why-functional-programming-sucks
The guy does have some point, writing everything purely usually complicates things a lot for practically no benefit, but he also seems unnecessarily bitter.
>>
>>51422084
are you really this retarded ? please don't be this retarded.
>>
>>51422085
>still no citation
>meme
>damage control over nine thousand
>>
why isn't python being abandoned for haskell?

haskell is as easy to use or easier, more powerful, and much faster.
>>
>>51422135
>I have no answer
ok
>>
>>51422197
So what does it print? You won't be assuming 2's complement, but you're still going to make an assumption on endianness, aren't you?
>>
>>51422255
2's complement was part of an example, just so you know
>>
Alright, you fucking guys, I've had it with the trolling in /dpt/! You have 10 seconds to prove the code you idiots have been arguing for half the thread contains or not undefined behavior: with actual references from the standard!
Do you know C or fucking not?
>>
>>51422232
That's like asking why people aren't abandoning bash for Haskell. They're not competing in the same field.
>>
>>51422232
Why isn't haskell being abandoned for go?
go is as easy to use or easier, more powerful, and much faster.
>>
>>51422280
fuck off

>>51422276
i'm asking why they're not competing in the same field
>>
>>51422280
Why isn't meme being abandoned for meme?
meme is meme to meme or memeier, more meme, and much meme.
>>
>>51422255
>>51422269
Nobody asked what it prints. The question was whether it contains undefined behavior or not.
What it prints is irrelevant when talking about undefined behavior. The result is implementation defined, but that's not what's being discussed here.
There are no assumptions made in the code about 2's complement that would render the code undefined on implementations with a different representation.
>>
>>51421139
>released in 2016
Goddamnit OP.
>>
>>51422272
No we don't
>>
>>51422255
>So what does it print?
>what is implementation defined
>what is unspecified
>what is undefined
m8, get them str8
>>
>>51422325
this tá Žbh sá Žmh fá Žam
>>
>>51422338
You're right kid, I don't know that, I don't care. Now start being practical so you can get out of autismbux.
>>
>>51421642
probably something to do with allocating *p with the size of *p.
>>
>>51422358
>You're right kid, I don't know that
>I don't know that
>I don't know
#REKT
R
E
K
T
>>
>>51422366
how else would you allocate it?
>>
>>51422358
>don't know
>muh assumptions
>muh practical autism
anon...
>>
Guys in java how do you initialize a ton of number arrays??

i want from 1-365 days and all i know is
 int days[] = {1,2,3.....,365}; 


is there a way were i can just type 365 and it generates 365 arrays for me??
>>
>>51422390
I would define it explicitly like sizeof(unsigned).

Besides it's a pointer, so you're allocating a pointer with a pointer's size instead of allocating it with the type's size, e.g. sizeof(int) vs sizeof(int*)

since *p is an unsigned pointer, the *p references to just p and yada yada yada -- it just seemed like it would produce undefined behavior.
>>
/g/ everyone: the place where "programmers" don't even know how to use memcpy! keep asking them for advice, what could possibly go wrong?!
>>
>>51422413
int days[365];
for loop. days[i] = i;
>>
>>51422413
int days[] = new int[365]
for(int i = 0; i < 365; i++) days[i] = i + 1;

dunno java syntax for array declaration tho
>>
>>51422420
>I would define it explicitly like sizeof(unsigned).
yes, that's how people that aren't sure of themselves to know C would do it
>you're allocating a pointer with a pointer's size
no
>instead of allocating it with the type's size
but that's what the code does: sizeof *p == sizeof (unsigned); do you even C?
>since *p is an unsigned pointer, the *p references
the word you're looking for is "dereferences" and no, the argument of sizeof is not evaluated
>>
>>51422071

I can believe there are some languages which don't allow it, I just don't know which they are.
>>
>>51422458
then where's the undefined behavior
>>
>>51422480
this guy >>51421666 thinks it's got to do with memcpy but seems unable to provide any reasoning
>>
>>51422413
>Guys in java how do you initialize a ton of number arrays??
Unfortunately java has no way to extend syntax to cover cases like this.

The best way for large static arrays is to write a little program which prints out the initialization and then you just copypaste it into the file.

But, um, can you let me know why
1) days is signed
2) why this is an array? If days[i]=i then just have a variable days?

Anyway that's my advice for fuckhuge static arrays.
>>
>>51422599
>days is signed
>signed
>java
anon...
>>
>>51422627
not a java expert mate, java really doesn't have an unsigned type? That's terrible.
>>
>>51422599
>365
>huge
anon...
>>
>>51422476
Is it something they may have updated in C#? Because I've been using it since 2008/2009 and if anything complained to me I'm pretty sure it was c#. Or like the other anon mentioned, it could've been complaining about a value return.
>>
>>51422662
it is
>>
File: GGEYU.jpg (103 KB, 500x494) Image search: [Google]
GGEYU.jpg
103 KB, 500x494
>>>/vg/122776251
>>
>>51422720
I find Linux to be a much better programming environment
>>51422717
>no unsigned
>can't pass by reference
What else can Java not do?
>>
I like learning about the machinery behind programming languages. Is there any resources where I can read more?

Also two unrelated questions:

1. In c#, I've heard that "new" doesn't actually instantiate an object rather it increments a pointer and then a group of objects gets instantiated when the garbage collector runs. In Java does "new" create the object immediately?

2. In dynamically typed languages is there a bottle neck by not declaring your types initially? Wouldn't be a lot of work for the interpreter to guess what type it should be and then cast the object to that type?
>>
>>51422720
unix was designed to be programmer friendly from the getgo, most linux distros even include everything you need to write C out of the box.
>>
>>51422776
go find a stdlib function you like a lot and look up it's implementation
then try to make your own
>>
>>51422761
can't optimize even the most trivial tail call because
>muh stack security inspection
even though when you force the programmer to make tail calls into explicit loops there's no stack information either (which is also why guido is an enormous faggot but whatever)

But overall Java is really not bad. Granted, now that Microsoft had a second go at it, C# is better (for windows). It used to be an easy choice because Sun was a good company but now that it is Oracle versus MS you might as well just use racket.
>>
>>51421139
The line with the second "printf" has undefined behavior because of *p.
>>
>>51421139
>The "I don't know C but I try really hard" edition

new fag here,
if I want to use cout & cin in c programs, should I name the files as "examples.cpp" and do the compilation with g++ instead of gcc.

replace:
#include <stdio.h> with

#include <iostream>
using namespace std;

I learned how to use printf & scanf, but I think

cout<<x;

is saner than
printf("%d",x);


No?
>>
>>51421139
malloc (sizeof(itself))???

what the fuck?
>>
>>51422476
I don't know one where a "return statement" exists for subprograms that return a value but is specifically disallowed as a way to exit early from ones that don't, but Pascal is an example where "return statements" don't exist so subprograms only have one exit, though pretty much every extension besides the ISO one added such a statement.
>>
>>51422833
standard C
>>
>>51422829
Have you ever tried any actual formatting with the stream operators?
It's fucking unreadable.
Just use printf for anything complex, or better yet, just use printf for everything.
In fact, why the fuck are you using C++?
>>
>>51422720
free(as_in_freedom);
>>
>>51422829
That's C++, not C.
>is saner than
It's not. It's tricking you because at first it looks like it's simpler. Shit breaks down fast when you need custom formating.
>>
>>51422823
qft
>>
>>51422797
I wasn't really talking about implementation. I'm more curious on how features of languages are actually handled by the compiler/interpreter. (E.g. when you make a delegate in c# what is happening that lets the compiler call one method signature and execute another) stuff like that.
>>
>>51421196
Reddit

Eve Online

NumPy
>>
Ask a C expert anything!
>>
can /dpt/ riddle me this

>295.0 / 32 => -536 mil
>295 / 32 => 9


why do i need to cast lhs to int when rhs is an integer and thus it should assume int division (as opposed to float division with 32.f)
>>
>>51421139

What are some most significant projects you've done?

Recommend me something to do in Python. No games.
>>
>>51422896
wen i get thing an put to six, it com back fouty six n i dont no why is hapen, u help pls
>>
>>51422896
Why has C lasted so long? It seems to do a lot wrong, but what are all the things it does right?
>>
>>51422907
second is integer division, everything past the decimal point is discarded.
Cast them as floats if you want floating point values.
>>
>>51422829
You're pretty much asking "should I use c or c++?" And the only answer to that is learn more.
>>
>>51422888
>Non power of 2 textures crash my opengl 2.1 application where they should be supported.
>This is another side effect of using amd videocards and processors isnt it?
>non power of 2
>opengl 2.1
found your problem
>side effect of
you don't knowing what the fuck you're doing


>>51422888
Non power of 2 textures crash my opengl 2.1 application where they should be supported.
This is another side effect of using amd videocards and processors isnt it?
>Non power of 2
>opengl 2.1
found your problem
>side effect of using
>>
>>51422894
>EVE Online
I always forget it is written in Python, the codebase is apparently a clusterfuck.
>>
>>51422234
not that dipshit, but...

undefined = mechanics are implementation specific and not part of the language standard so nobody can guarantee (i.e. define) what you'll get with a particular code when compiled/interpreted in a particular environment.
>>
>>51422919
>second is integer division,
yes, but so is first

>everything past the decimal point is discarded.
yes, and that's what i expect

>Cast them as floats if you want floating point values.
i don't, i wanted integer values, i'm asking why do i get that bizzare result with integer division in the first place
>>
>>51422912
>Recommend me something to do

No point, unless you want to do it you won't finish it. My advice, find something you want to make
>>
>>51422917
Simple language to implement. Performance.
>>
>>51422917
C is still in use because:
It's pretty tiny
It's blazingly fast (and not filled to the brim with crap like c++)
It's high-level enough to be useful
There is a c compiler for every architecture imaginable
>>
>>51422914
pls respant >>51422896
>>
>>51422907
most programming languages assume that the result of mixed operations yield a result which is the smallest value that can hold any individual terms

Since you can't hold a float in an int, the terms are all converted to floats and then the arithmetic is performed.

I'm going to be honest I really hate this feature in programming languages. Implicit conversions are shitty. I try to use rationals whenever feasible, which is 99% of the time.
>>
>>51422939
Then any program involving floats has undefined behavior, since the standard says nothing about the encoding of float and double values.
>>
>>51422917
well, when every other language has their compilers implemented in C, why would you use anything else?
>>
>>51422952

I was thinking of starting python/django and build some web apps. I'm already doing android but I need to learn at least another language or two well.
>>
>>51422939
>undefined = mechanics are implementation specific
that's called implementation defined.
>not part of the language standard
the standard tells what is "undefined behavior"
git gud anon!
>>
>>51422988
>django

I recommend flask instead
>>
>>51422942
>yes, but so is first
wrong
>i wanted integer values
then use integer values
>>
>>51423022
seconding flask
>>
>>51423022
>>51423032

Isn't flask a lower level framework? I chose Django for employment prospective as well.
>>
>>51423051
>employment prospective
>what is node
>what is mongo
>>
File: 1441640667311.png (1 MB, 1065x1071) Image search: [Google]
1441640667311.png
1 MB, 1065x1071
>>51423051
>I chose Django for employment prospective
>>
>>51423061

Is nodejs still relevant?

>>51423066

I don't understand what it is you're trying to say. I'm European and Flask is used very little.
>>
>>51421666
>doesn't know C
>unqualified to discuss the standard
>talks about bits
>meme "unsigned's store"
>proceed to get told by everyone
shyggy diggy /g/
>>
>>51423088
>Is nodejs still relevant?
compared to django? it's like windows vs gentoo in terms of popularity
>>
>>51423114

Not in Europe.
>>
Is using multiple design patterns in one codebase bad design? (I.e. if I implement an observer pattern for one feature and use composite design to achieve another feature)
>>
>>51423120
you're drunk
>>
>>51423096
>get buttrekt hard
>display his lack of knowledge for all to see
>proud to having to resort to samefagging to get anywhere
>doesn't even know how to fizzbuzz
SJW everyone!
>>
>>51423130
>multiple memes
>bad meme
>meme pattern
>meme design
>achieve meme
anon...
>>
>>51423136

Just look at job sites, it's very easy to get an idea even if you don't live here.
>>
>>51422962
>There is a c compiler for every architecture imaginable
Except for mine.
>>
>>51423141
>he mad for getting told
lel
>>
>>51423149
go back to writing fizzbuzz in the absolete garbage that c is
>>
>>51423141
>doesn't know C
>mad when proven with facts that he's a moron
back to css!
stay pleb
>>
>>51423181
>doesn't know how to fizzbuzz in superior Go
m8...
>>
>>51423158
I don't believe that...

which architecture is it? Im pretty sure there's a c compiler for my microwave.
>>
>>51422923
I just came across some C tutorials, the author is explaining everything in specifics related to C, he just uses cin and cout instead of printf and scanf but everything else in the program is c and not c++
>>
which language should electic/machanical engineers learn in their degree, in my university they have to do a c++ class
>>
>>51423226
C and C++
so C++
>>
>>51423141
Made you my bitch, didn't I, you autistic fuck? Schooled you hard on undefined behavior. Everyone knows how shit you are at programming now. Just git gud and maybe next time you'll do better.
Truth be told, you had no change against a based C god like me that knows everything there is about the fucking language in my 30+ years of high-profile advanced C programming. You gonna be jelly forever? Read a book or keep flippin' dem burgers, your call.
Faggot.
>>
>>51423201
That's messed because cout is in the standard library iostream. Which as you know is a c++ library.

printf and scanf are part of the c library stdio.h

This is an important difference because c needs the dot h to find header files, you couldn't compile a working program without it. The reverse is false though (you can use printf in c++)
>>
File: 1447350091774.png (24 KB, 566x361) Image search: [Google]
1447350091774.png
24 KB, 566x361
>>51423200
>which architecture is it?
I haven't given it a name yet, but the assembler language for it is called vasm (virtual assembler) so i guess I'll go with that for now.
There is no C compiler for the platform in pic related.
>>
>>51423273
I will stick to printf & scanf then
>>
>>51423277
It is now my mission to build a c compiler for your architecture

Give me OP codes
>>
>>51423277
>no c compiler for the platform in pic related
>pic related is gnu/linux
m8...
>>
>>51423270
Good god you sound like a pretentious faggot.
>>
>>51423270
You need to be 18 to post here.
>>
>>51423293
>xterm
>so it must be gnu/linux
Fuck off
>>
File: 141511111.jpg (11 KB, 300x200) Image search: [Google]
141511111.jpg
11 KB, 300x200
repostan

I'm usually a sepples man but I'm willing to learn webdev(because no webassembly) to do the following: interactive infographic framework/editor thing with easy localization(think of xkcd's rocket or the rendering equation explained in 100 words being easier to popularize)

Am I being silly, is there something like this out there already, or should I start learning me some java scripts?
>>
>>51423333
nice quads m80
>>
>>51423296
>I want to be you
>why did you have to destroy me like that
Suck it, fag!
>>51423322
No such requirement. You don't know even that, how did you think you'll ever be good at programming of all things?
>>
>>51421642
> Does anyone know why the OP code has undefined behavior?
Because it uses memcpy(), abort(), malloc(), free() and printf() but doesn't include <stdlib.h>, <stdio.h> or <string.h>?

Other than that, I don't see any reason for UB in the code itself. However, the fact that the return type of test() is int but it doesn't return a value may result in UB if whatever calls test uses the return value (there is no UB if the return value from test() is ignored).
>>
>>51423324
it is tho
>>
>>51423357
I'm not him. Just a random person watching you shitpost. Believe me, the last thing I want to be is you.
>>
>>51423362
>Other than that, I don't see any reason for UB in the code itself.
see >>51422823
>>
>>51421654
Yeah, I might not have explained the program well enough. The way the algorithm works favors featuring prominent colors over making the color choices as accurate to the base colorscheme as possible.
>>
>>51423288
Okay, but i won't be able to give you anything very useful, and by the time you finish this compiler i can assure you that instructions would have been added, removed and semantics changed.
And if your going to compile down to my assembler language, then that would be even more unstable since the language changes pretty much every commit.
Also i have not documented it at all.
Good luck though.

opcodes.h: http://pastebin.com/LKBH3aiC
Sample assembler code: http://pastebin.com/Yy1H8G83
Floats are supported, they're just not shown in the sample code, it uses the same syntax as byte/short/word/double just with a float keyword instead.
>>
>>51423378
>I want to be you
I know. I also have a big dick. That's right, I'm a big dick playa! We're talking "swinging past your knee" big dick here.
>>
>>51423398
Was just bustin' yer chops; sounds like a neat project.
>>
>>51423293
>>51423324
>>51423373
Look at the text in the terminal fucktards.
>>
>>51423399
so you don't have a "platform" you have a "project for a platform", like all tards on /g/.
got a logo yet?
>>
>>51423413
Use a trip so I never need to read your inane bullshit please. Better yet, off yourself.
>>
>>51423388
> see >>51422823
Doesn't give any reason for UB. "Because *p" isn't a reason for anything, let alone UB.
>>
>>51423425
I have a working assembler, a working linker, and a working vm.
It's in early development but it works.
I do not have a logo for it.
>>
>>51423427
umad, poorfag? ever got on a G5, playa? or do you rack them frequent flyer bitch miles?
>>
>>51423444
>I do not have a logo
why don't you start with the important things, anon?
>>
>>51423462
Because I'm not a typical /g/tard like you claim.
I don't give a shit about logos.
>>
>>51423451
...He said to the guy, sitting in his office making bank to argue with a faggot. Unfortunately, a client arriving in 12 minutes had this man too distracted to continue arguing with the mentally challenged child. From that day on, there were no more (You)'s to be had.
>>
>>51423481
depends what kind or programs you intend to write, anon
>>
>>51423481
>This may sound stupid since I am kinda directionless but what is the basic math knowledge I should have if I want to get more creative with a calculator?
>>
>>51423441
>"Because *p" isn't a reason for anything, let alone UB.
"*p" is "dereference of p" which is a read access on the object at address "p" as unsigned.
That's undefined behavior. Got it now?
>>
>>51423501
>I'm important
Not important enough to be a big dick playa, are you, pecker?
>a client arriving in 12 minutes
Prepare your anus, fucboi!
>>
>>51423518
>doesn't know C
>unqualified to discuss the standard
>talks about *p
>meme "UB"
>proceed to get told by everyone
shyggy diggy /g/
>>
File: 1446052848034.jpg (132 KB, 735x720) Image search: [Google]
1446052848034.jpg
132 KB, 735x720
>>51421290
Thanks a lot m8, nearly squirted soup out of my nose
>>
>>51423562
But you didn't "tell" anyone anything. If you consider the post you quoted to be "meme" then I have bad news for you: it's the terminology used in the standard which apparently you've never seen.
Guess who's the unqualified now.
Oh, you meant to say that the explanation is too scientific and you want it dumbed down further? Why don't you just say so?
Git gud.
>>
File: I am so sorry.png (66 KB, 947x839) Image search: [Google]
I am so sorry.png
66 KB, 947x839
I am trying to download
https://github.com/dmanning23/BulletMLLib
but when I do
git clone --recursive https://github.com/dmanning23/BulletMLLib.git


I got this error on the last external three times in a row.
http://pastebin.com/StfpTMLg (pastebin cause 4chan thinks it is spam).

Not sure where to really go from here cause I'm reasonably new at github.
>>
>>51422829
Put -Wall somewhere in the gcc command line, it enables A LOT of very helpful warnings about what you're doing wrong. I think it should be mandatory for learners, along with -Wextra and -Werror, just like the wheels on the side of your children's bicycle. ("The little wheels", but no one was going to get it ^^
>>
>>51423477
>I'm not a typical /g/tard
that's exactly what all /g/tards say: they're special snowflakes
>>
>>51422874
Isn't there a autosprintf function by GNU somewhere that does printf-like formating?
>>
>>51423518
> "*p" is "dereference of p" which is a read access on the object at address "p" as unsigned.
> That's undefined behavior. Got it now?
Nope. If it's actually UB (and I still don't think it is), you're going to need to cite chapter and verse, or at least be explicit enough that it's possible to deduce which of the many specific reasons for UB you're actually referring to.

p has type unsigned *, it is initialised from malloc(sizeof *p) which will either return NULL (that case is checked and handled with an abort()) or a valid pointer to storage of sufficient size and alignment. Dereferencing it yields an unsigned, which is what printf() expects.
>>
>>51423600
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone of '[email protected]:dmanning23/MonoGame.git' into submodule path 'externals/MonoGame' failed
>>
>>51423481
Discrete math is useful no matter what. Linear algebra is useful if you're doing anything with graphics. Statistics is useful for a lot of kinds of programming, especially programming involving modeling or machine learning. Calculus is useful for physics and math-y programming
>>
>>51423273
I'm pretty sure the .h is just a convention
>>
>>51423273
stop posting
>>
>>51423600
github is a nigger, what else is new.
>>
File: 1446072119834.jpg (12 KB, 225x225) Image search: [Google]
1446072119834.jpg
12 KB, 225x225
>>51423501
>>51423427
>>51423378

>feeding the shitposter
please also kill yourselves
>>
>>51423600
>>51423858
Couldn't figure out what to do but it's an external to monogame, which I not only have is part of my project. So the library should work fine no?

Honestly this has just been a frustrating venture and setting up github and getting it to finally work and failed at the end, I honestly probably could've made my own parsar (albeit probably shittier).
>>
How do I achieve something like Boost.Python except in D? I want to be able to expose D functions to D and load Python scripts and call them from D (I /do not/ want to write a separate Python module in D like the DPython binding does).
>>
What projects do you recommend for mid - advanced programmer , beyond loops and pointers , text editor ?
>>
>>51423962
build a neural network from scratch

classify the MNIST dataset
>>
>>51423962
>mid - advanced programmer , beyond loops and pointers
>mid - advanced programmer
>beyond loops and pointers
what?
anyway, something related with your interests? A simple 3d game, small irc client, scheme compiler, or just study some algorithms
>>
>>51423962
>beyond loops and pointers
>mid - advanced programmer
https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
>>
>>51423962
>mid - advanced programmer
>loops and pointers
>text editor
>>
>>51423635
Alright, your post is coherent to warrant a serious explanation (as opposed to wasting my time with idiots that don't even know what UB means).

>p has type unsigned *, it is initialised from malloc(sizeof *p)
That is correct.

>Dereferencing it yields an unsigned
Unfortunately, no; not in this case. Instead, it's UB.

Paragraph 6.5p7 of the C standard defines all valid accesses to objects and it says (in short, discarding the details irrelevant to our case) that objects must have their value accessed only by an expression with a type compatible with the ***effective type*** of the object.

"Effective type" is defined in 6.5p6 and contains this interesting bit
If a value is copied into an object having no declared type using
memcpy or memmove, or is copied as an array of character type,
then the effective type of the modified object for that access and
for subsequent accesses that do not modify the value is the effective
type of the object from which the value is copied, if it has one.

Also, it says that "allocated objects have no declared type" which is the case of "*p" in the discussed example.

Recap:
- "*p" has no declared type because it's an allocated object
- "memcpy" from a float to "*p" makes "*p" have an effective type of float from that point onwards (until the next write access, of course)
- dereferencing "p" with "*p" is an invalid access, because it is an expression with type "unsigned" but the object stored at address "p" has type float; the correct dereference would be "*(float *) p" (which obviously would result in a float value, that still can't be printed with "%u").
>>
>>51424120
>*p has no declared type
Found the inbred!
>>
>>51424120
You literally do not know what an effective type is, nor what a declared type is. Nice try though, kiddo.
>>
Coding newfag here

Any recommendations for sites or books with practice problems similar to FizzBuzz?

I'm already balls deep into Project Euler and I'm looking for some more resources to supplement my learning.
>>
>>51424238
Are you seriously this dumb? Did you miss the "allocated objects have no declared type".
>>
>>51424252
Read the standard and apply yourself, retard. You just got told.
>>
>>51424261
You should go back to kindergarten where you belong. Maybe this time around you'll get the hang of reading comprehension.
>>
>>51424252
what are they, anon?
>>
>>51424261
>>51424273
lol butthurt
>>
>>51424257
Tornado text.
TO BE HONEST, FAMILY
O BE HONEST, FAMILYT
BE HONEST, FAMILYTO
BE HONEST, FAMILYTO
E HONEST, FAMILYTO B
HONEST, FAMILYTO BE
HONEST, FAMILYTO BE
ONEST, FAMILYTO BE H
NEST, FAMILYTO BE HO
EST, FAMILYTO BE HON
ST, FAMILYTO BE HONE
T, FAMILYTO BE HONES
, FAMILYTO BE HONEST
FAMILYTO BE HONEST,
FAMILYTO BE HONEST,
AMILYTO BE HONEST, F
MILYTO BE HONEST, FA
ILYTO BE HONEST, SENPAI
LYTO BE HONEST, FAMI
YTO BE HONEST, FAMIL
TO BE HONEST, FAMILY
>>
>>51424288
>so mad for getting owned on a chinese site
lel
>>
>>51424273
>Read the standard and apply yourself, retard
Oh the irony
Thread replies: 255
Thread images: 18

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.