[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 | Voyeur Cams | Click for more| Home]

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.
Voyeur Cams

Thread replies: 510
Thread images: 30

File: 1436023689035.png (18KB, 252x223px) Image search: [iqdb] [SauceNao] [Google]
1436023689035.png
18KB, 252x223px
Old /dpt/ at >>51494191 What are you working on?
>>
First for C
>>
File: 1447689862747.jpg (726KB, 2048x1536px) Image search: [iqdb] [SauceNao] [Google]
1447689862747.jpg
726KB, 2048x1536px
How do i memory optimization?
>>
>creating a thread more than 30 minutes after an identical one when the bump limit hasn't been reached
kill yourself
>>
>>51501312

that code in the pic is making me bilious.
>>
>>51501407
THANKS FOR POSTING IN BETTER THRED

REEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
Getting myself ready to do Launchcode.org's "coding challenge", basically the first step towards getting an interview with them

they say to watch this https://www.youtube.com/watch?v=YnM3dsefgvY

and then do this practice test
https://www.hackerrank.com/tests/ioa3k1bq/20d367dea19077ca7ececdd3a8fcd5e7

and then the actual thing is timed at 90 minutes with three sections and you can use whatever language you want. I dunno hopefully I don't buttfuck it so hard they laugh in the office and never call me
>>
>>51501450
what kind of bullshit test is this?
How am I supposed to solve their number counter challenge if I can't edit the main loop?
>>
>>51501312
something to replace notepad
>>
>>51501312
shows how microsoft didn't advance
they still have the same shit on the gui
nothing progressed since win 3.11

its f*cking garbage
>>
>>51501450

I can't help but notice this guy seems like a fucking idiot about solving these problems. He was given a plain English description of exactly what he needed to do, and yet was acting as if he was trying to find out what it was that the question was asking him to do.

I can fucking solve the goddamn challenge faster than him.

void countUp(int start) {
for (int i = 1; i < 10; i++) {
printf("%d then ", start + i);
}
printf("%d", start + 10);
}
>>
why isn't there a sticky for these threads

how do i get started with this programming thing lads
>>
>>51502186
go back to reddit you cancerous faggot
>>
>>51502186

>why isn't there a sticky for these threads
Because they are cyclical. No mod wants to have to sticky a thread, and then delete and re-sticky a thread every time they get too large to load.

>how do i get started with this programming thing lads
Learn C. I recommend C Primer Plus as a choice of books.
>>
>>51502452
fuck c
python
>>
>>51502590
Pythonfags are by far the worst memesters.
>>
>>51502452
>C Primer Plus

thanks

>>51502601
why is python meme
>>
File: 713455213465.png (37KB, 1048x870px) Image search: [iqdb] [SauceNao] [Google]
713455213465.png
37KB, 1048x870px
>tfw solely used notepad to program C for 3 years

it was a learning experience
>>
>>51502641
Python is not a meme. C is the biggest meme.

>>51502671
>learning experience
What did you learn by doing that?
>>
>>51502733
>What did you learn by doing that?

pain.
>>
>>51501368
a) Primarily by moving you're code over to Sepples.
b) see a)
>>
>>51502733
i had previously used IDEs and let them handle the compiling and whatnot, so i didn't completely understand what was going on when i hit the "compile and run" button

i learned to use gcc and make
now i also make fewer simple mistakes (the kind that IDEs handle for you)

also this >>51502763
>>
>>51502826
Why didn't you use Vim? You would learn all that without pain.
>>
>>51502452
Why C? C++ is the first language I learned and I don't think it was necessarily helpful to do so. I think C would have been even less helpful to learn first.
>>
>>51502902
I'm not so sure either. But c/c++ teaches you very well that everything is basically nothing but a series of pointers pointing at arrays.

Knowing that changes how you program, but javascript guys get things done more quickly
>>
>>51502926
It's not really helpful 'knowing' that IMO. I don't know if that changed how I program because I started with it, but these days I expend a lot of effort into not thinking about things like that.
>>
>>51502926
You are ignorant.
Modern C++ (the proper way of writing C++) doesn't use raw pointers. Also, everything is not a series of pointers. Pointers are just features that some programming languages support.
JavaScript guys will get things done more quickly and more safely than C guys.
>>
>>51502950
Pointers still form the foundation of C++. People did overuse pointers in the past, although even with C++98 that was poor form. Thinking about memory as locations that can be accessed with pointers is... still as 'helpful' as it has ever been.
>>
should I learn python as my first language?

i learned a bit of java and I fucking hated it

println is WAY better than Systen.Out.NiGgErS.ToUnGE[].!My.Angu$
>>
>>51503108
Don't fall "Java is bad" meme. It is good.

Also, you will like Python if you don't like typing much.
>>
>>51503118
thank god

is it marketable / useful?
>>
>>51503108
Java doesn't fuck about, its names are famously verbose.

Python has shorter names and is generally shorter than Java (and more verbose in all its friggin docs, look forward to being eternally spoon-fed you entitled swine).
>>
>>51503128
If you are to have a palette of different languages, a scripting language like Python is usually worth having. If I had to chose one scripting language it would be Python.
>>
>>51503108
>i learned a bit of java and I fucking hated it
I used to hate it as well but now it's my language of choice next to c++.
>>
Can someone tell me why the resource is not applied to this button? I have this in my Page.Resources
<Style x:Key="sideButton" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="#FFF"/>
<Setter Property="Height" Value="50"/>
</Style>


and this in my codebehind

Button sideButton = new Button();
sideButton.Name = "btn";
sideButton.Content = "HelloWorld";
sideButton.Style = Application.Current.Resources["sideButton"] as Style;
sideButton.Click += sideButton_Click;
rightPanel.Children.Add(sideButton);


Not sure if i'm missing something simple or completely off the mark
>>
>>51501312
> pic
Should have typed this in MS Word.
>>
do you ever have a moment where you remember why you love programming?

I was sitting around with my roommate who is working on a compiler and we were sitting and whiteboarding out ideas and I was just kind of in awe at how much fun I was having. Programming is just so satisfying when you're doing logic heavy stuff.
>>
does anyone else scrape websites only using substrings and indexof?

is there a better way? I've thought about using regex but I'm already so good at it this way
>>
>>51503302
https://www.youtube.com/watch?v=P-hUV9yhqgY

relevant
>>
>>51503298
notepad is plenty retarded to write code in
>>
>>51503302
I only have these moments on my own.
>>
>>51503302
>>51503339
i want normies to leave
>>
>>51503355
Dunno about normies but I feel like the people who say stuff like "love programming" are deluding themselves.

I don't love programming, I do it because it's the kind of habit I get into trying to make things happen. Sometimes I appreciate the result but I don't 'love' programming, that's just a step in the journey.
>>
>>51503355
Oh, you'll get your time.
Soon enough I'll have to do some work for a living and you can have your toys to yourself.
>>
What advantages would switching from sublime to emacs or vim bring me other than 1337 cred
>>
>>51503384
Wow you really are cancer
>>
>>51503420
Lots of editors have okay to decent vim bindings provided as plugins or whatnot, so learning vim could be quite advantageous in being able to work with lots of different editors efficiently.

Er and bash and gdb use commands similar to emacs so I guess that's helpful. Not really that helpful.
>>
>>51501312
>inb4 bait

>void main
>returning a value
>returning anything other than 0 for a successful run
>not using a semicolon ;
>>
why would i use anything other than this beauty?
>>
>>51503463
>emacs

Well if you can use it, sure. When you get RSI you can come join the vim club.
>>
>>51503461
You missed some.
>incorrect preprocessor syntax
>string[]
>print
>indentation
>pipe
>using true in what is probably meant to be C
>>
is there a built in function in directx for transforming a vector of normalized device coordinates to screens space using a D3D11_VIEWPORT structure or do i have to do that manually?
>>
>>51503463
>const correctness
Missing some consts mate
>>
Is this as fast as it can get? The actual code is in c, i pasted it in pseudopython just to make it less verbose

running_queue = []
finished_queue = []

def worker()
while True:

# i make a local copy so that other threads
# can still push stuff into running_queue
lock(running_queue)
local_queue = running_queue.pop_all_items()
unlock(running_queue)

while local_queue:
task = local_queue.pop()
task.run()
if task.finished():
lock(finished_queue)
finished_queue.push(task)
unlock(finished_queue)
else:
lock(running_queue)
running_queue.push(task)
unlock(running_queue)


def main()
while True:
push_some_tasks()

lock(finished_queue)
while finished_queue:
task = finished_queue.pop()
task.callback()
unlock(finished_queue)
>>
I am the only one that find low level programming easier than high level programming ?
>>
>>51504017
No.
>>
>>51504017
No. I think it's because the lower you get the more well defined the things are.
>>
>>51502072
Not <=10 to save that last line???
>>
>>51504052
>>51504053
It's been two days that I'm trying to create a simple app for my ubuntu touch in QML. I never thought a language could be that bad.
Whatever. I'm going to look for another language and library to create something good.
I really wonder how people are still developing in .net and other bullshit like that.
>>
>>51503463
nice warnings faggot
>>
>>51501450
>Just for fun. No pressure. Watch this video for tips on how to rock your interview.
not sure if socially retarded or catering to pussy ass faggots
>>
>>51504165
then it would print an extraneous " then " at the end
>>
>>51502950
>>51503096
It's important to differentiate between 'user applications' (ie, the stuff being written largely by the ppl on /g/), and 'library code'.

Library code relies heavily on low-level coding approaches such as heavy pointer use. This allows them to have the efficiency demanded by library code.

User applications however isn't the place for low-level code. Rely on the abstractions provided by good library code. That way the complexity of user application code is easier to reason about, and efficient, without getting bogged down in the details of low-level structures &tc. implementations.

This is the essence of modern C++. But make no mistake, pointers are still very important, but don't typically use them you'reself.
>>
I would say python then c++ and if you still enjoy it by then pick up C# or java.

Those three langs above make for a well rounded programming toolkit.

Python os easiest -- the simple syntax and readability will allow you to focus on implementing logic into your program without getting too fustrated.

C++ is actually a lot like python, just a lot more low level too. You have to be more explicit with C++ in telling it what you want. It wont hold your hand as much as python. Youll learn about memory management and making the most out of properly designed OOP. Plus you *essentially* learn a bit of C while learning C++ (C++ = C plus a bunch of extra library stuff)

Lastly with C# or Java, its kinda the best of both words. These langs meet halfway between python and C++. These are good for making a full project but still doing so with some ease. Python is a scripting language and is good for quick problem solving but may not be the best choice for a single solution to a large project .

C/C++ could also be used for entire projects but could be more work than necessary - often, only speed critical parts of a program are written in C/C++ (as its very fast).

C# and Java are very popular in the 'real' world and a lot of enterprise code is written with these langs.
>>
>>51504359
>python
get out
>>
>>51503211
>c++
hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
>>
If you want to end up as jobless faggots like these two though..

>>51504371
>>51504394


..then just learn Lisp and call it a day
>>
>>51503108
absolutely disgusting please fuck off to >>>/vg/agdg
>>
>>51504371

Plus.

"[since 2014] Pythonis currently the most popular language for teaching introductory computer science courses at top-ranked U.S. departments.

Specifically, eight of the top 10 CS departments (80%), and 27 of the top 39 (69%), teach Python in introductory CS0 or CS1 courses."
>>
>>51504416
>>>/trash/ with your speech impediment
>>
>>51504440
as if that's a good thing
>>
for my first language, should I learn java, python, or C?
>inb4 assembly
>>
>>51504440
python really goes well with diversity doesn't it mate
>>
>>51504440
>eight of the top 10 CS departments (80%)
that's because those cs people can't code for shit, they are competent at cs but not at coding, the professors just want to make their life easier.
>>
>>51504461
Out of those three, C

But really you should start with C++.
If you learn C++, you will learn most C along the way.
>>
>>51504461
http://qr.ae/RbpIBr
>>
>>51504482
Ignore the Java fag. It's literally the worst language.
>>
>>51504440
It's simply an artifact of institutions trying to cater to women and other minorities. However industry wants less and less to do with CS programs (predictably) when looking for developers. They go increasingly to CE and EE graduates, because they have been exposed to real-world problems and those programs stress solid engineering approaches, not "muh cute fluffy bunnies".

Python itself is a nice language when coupled with good libraries, but programs using it to introduce programming are not.
>>
>>51504469

Thats also a good point. Its easier on the sudents, the professors and it teaches basic OOP and allows students to take their knowldge further with other languages.

So whats the problem again?
>>
>>51504461
none of the above?

>>51504474
this.
>>
>>51504522
Fuck off Bernie
>>
>>51504536
I swear im not bernie sanders
>>
Why doesn't /dpt/ use Common Lisp? Any reason except "I don't know lisp and it looks daunting to learn"?
>>
>>51504612
Because some of us need to support ourselves rather than relying on mommy and her spare basement.
>>
>>51504612
See
>>51504416
>>
>>51504612
It's meme tier and lacks actual api
>>
>>51503252
you really need some MVVM up in this, yo. it'll make things a lot easier in the long run
>>
>>51504482
>If you've never programmed before, I'd generally recommend Java as a first language. Python is a great language, but in its attempt to make things easier, I think it actually makes some things harder for a new programmer. Python hides too much and that makes things confusing for a new programmer.
literally this except python is a horrible language regardless
>>
>>51504612
why would i use common lisp? any reason except "hurr i'm a neckbeard neet"?
>>
>>51501312
Building a Lisp, implemented in the following way with the help of Objective-C, YaCC, Lex, and itself:

This Lisp is called Valutron. It is architected as an integrated compiler-VM; essentially, this means that code, when entered at the REPL, is first converted into Cons trees, and then mapped down to primitive operations at the stage of evaluation. These primitive operations control a register VM, which operates on Cons cells and Objective-C objects representing Lisp values, and which is implemented as threaded code for maximum performance.

This form was chosen to make it possible to implement continuations easily and to promote good performance. At this point I have described how it implements a basic Scheme-esque Lisp. The VM, as I explained, operates natively on Cons cells. Implemented in Valutron itself are more extensible versions of some primitives like eval; these functions are registered with the VM and, from there on, replace the primitives with themselves.

Here is where Valutron offers a feature called V-expressions. V-expressions are an alternative to S-expression notation for code. They are low in the number of brackets characteristic of S-expressions, and are instead primarily algebraic-style infix. These are implemented by using reader macros. I am going to look into integrating a shift/reduce GLR parser that may have productions and rules dynamically altered at runtime, which will allow the extension and modification of V-expression syntax as well as even creating new DSLs with unique syntax.

The pièce de résistance is an object model inspired by the CL Object System, the first ever standardised object-oriented system, which was designed as part of Common Lisp. This is implemented in terms of the Objective-C runtime and hence the full dynamism of Smalltalk, Objective-C, and CLOS are available. The Objective-C runtime used was extended in order to support double dispatch, making available CLOS' characteristic multi-methods.
>>
>>51504995
gay
>>
>>51505038
2nded
>>
>>51505038
this
>>
should i make a website or a game
>>
>>51505067
website. video games are for degenerates. the world will be better off when the kikes are dead and video games are a thing of the past.
>>
>>51505073
games are equal to movies
>>
>>51505093
video games are a waste of time that kikes want you to believe are a work of art. like anime, vidya is how the kikes are trying to destroy the white race.
>>
>>51505110
like movies, they are a medium to pass information
>>
>>51505118
what info? like how you should be liberal and race mix or be a faggot? fuck that.
>>
>>51505135
k, what should the website do/ what should it contain
>>
>>51505067
a game

>>51505073
web dev/web design is top plebdom
>>
>>51505135
how to contain anit-liberal information there
>>
>>51504669
>>51504678
>>51504866
>>51504936
I said except the "I don't know lisp" reason.
>>
>>51505404
lisp is literally useless you faggot

the only functional languages worth learning are Erlang/Elixir and even those have very limited usefulness.
>>
>>51505404
why don't you obey Allah and the words of the prophet Mohammed? any reason except "i don't know islam"?
>>51505426
this
>>
>>51505446
>>51505426
>literally useless
>no explanation
Again, do you have any reason except "I don't know lisp and can't be bothered because I'm a web developer"?
>>
>>51505446
>any reason except "i don't know islam"
No, none. It's the same for you and Lisp? If so, don't bother replying because I specifically asked for reasons other than "I don't know".
>>
>>51505426
>the only functional languages
>lisp
>functional
So I was right, you don't know Lisp. Please refrain from replying if you don't understand what the adults are talking about.
>>
>>51505545
(>(>(>(/(t(r(a(s(h(/))))))))))
>>
>>51505555
>muh twitter
ishiggy...
>>
I'm currently learning C# at college - right now it's all programming for Windows phones using Visual Studio. I'm having a blast with if statements.

Also following that Bob Tabor guy's videos on C# fundamentals - they're pretty good. I've just made a super simplistic program with yes/no inputs from the user to generate new "situations" - imagine a "choose your own adventure" book but it was only 3 pages long.

God I can't wait to learn more!
>>
>>51505426
>lisp
>functional
m8...
>>
what's the most difficult language
>>
I want to display an image when I click on a button. But I want to display it on the same page where the button is located. How do I achieve that ?
>>
>>51505578
I don't have time for social media nor do I care about what any of those people have to say.
I read this shithole while I'm at work.
My quads don't lie, lisp is fucking useless. Go stroke your ego on reddit.
>>
>>51505555
>I don't know Lisp
>I don't know C
>I'm not a programmer
what DO you know, webfag? CSS?
>>
>>51505606
javascript?
>>
>>51505605
haskell by far
>>
>>51505613
>while I'm at work
did you get the CSS to render acceptably on both safari and ie8? hard stuff, wageslave, better put in some more hours!
>>
>>51505606
CSS

don't use fucking javascript ever
>>
>>51505613
>lisp is fucking useless
How would you know when you admitted you don't have a clue about Lisp? Did somebody you follow said that without offering some context? Don't be so gullible, anon!
>>
>>51505615
Oh, I'm not that guy. My first reply in the thread was the quads one. I do in fact know C, it's the main language I program in when I have time. I don't work as a programmer.

I did try webdev. I hated it. Back when I was nine I had my first website online. Complete with javascript fireworks which I copy/pasted in. Back when I was nine, that was a common thing to see, though. geocities/homestead/angelfire or whatever.

>>51505641
>wageslave
Here's your (You) while you sit at your parents house wearing out your parens, buttercup!
I'll be in my office.
>>
>>51505650
found the framework fag
>>
>>51505622
>>51505650
I'm working with ASP.NET MVC and C#. But I guess it can be done with simple HTML.
Any code ideas ?
This is what I have so far but it opens the image in a separate cshtml.
<input type="button" value="Create" onclick="location.href='@Url.Action("DrawChart")'" />
>>
>>51505673
>I don't work as a programmer
>I had my first website
>javascript fireworks
Your opinion is irrelevant here. Go post in a homescreen thread.
>>
>>51505681
javascript fags are the framework fags you fucking tard. if you can't code CSS by hand you fail at life.

>>51505694
i bet you'll get better answers in >>>/g/wdg
>>
>>51505707
Thank you.
>>
>>51505694
Mate, you have no fucking clue what you're doing. You're trash, you're not a programmer. The "simple HTML" contains javascript, web monkey.
>ASP.NET MVC and C#
You're in over your head. Better quit and go flip some burgers.
>>
File: Logo_lisp.gif (11KB, 700x385px) Image search: [iqdb] [SauceNao] [Google]
Logo_lisp.gif
11KB, 700x385px
>>51505038
>>51505044
>>51505056

How is it gay?

>>51505598
It's probably part of the key aspects that make a Lisp a Lisp that the language is built on the Lambada calculus. A model of computation that focuses explicitly on the application of functions.

>Here's your (You) while you sit at your parents house wearing out your parens, buttercup!
>I'll be in my office.
Have fun with that alienation and insignificance.
>>
>>51505707
>code CSS by hand
badass over here! great skillz, webtrash!
>>
>>51505728
https://en.wikipedia.org/wiki/Gay_lisp
>>
>>51505701
So because I showed interest at a young age in creating stuff, don't have a job as a codemonkey and program in C for my own pleasure and knowledge, I belong in a homescreen thread and my opinion (which it is just that, as is yours) is irrelevant?

Damn. I guess I'll be on my way then. I clearly don't belong here since I don't get paid to program and built a website almost 17 years ago while you were still probably swimming in your father's balls.
>>
>>51505728
>Have fun with that alienation and insignificance.
i've seen some projection in my life but holy shit
>>
>>51505728
>It's probably part of the key aspects
It's not. Please, if you don't know what you're talking about, do us all a favor and stop publicly embarrassing yourself.
>>
>>51505613
>I'm at work
so how does it feel to be a wagec.u.c.k wasting your time working? I'm a NEET and have unlimited freedom not being enslaved by my jew boss to make him more money.
>>
>>51505743
>young age in creating stuff
>built a website
>don't work as a programmer
>I'll be on my way then
Sounds about right.
>>
>>51505722
U wot m8 ?
Give me a suggestion then.
>>
>>51505743
>don't have a job
>website
>homescreen thread
>opinion is irrelevant
>don't belong here
git gud, fgt cuk
>>
>>51505743
>26 year old trying to play the oldfag card

>I did try webdev. I hated it. Back when I was nine I had my first website online. Complete with javascript fireworks which I copy/pasted in. Back when I was nine, that was a common thing to see, though. geocities/homestead/angelfire or whatever.
tippity top kek
>>
>>51505673
>can't write 2 sentences to defend opinion on lisp
>blog post about his "early life as webfag"
Seriously, m8? And you expect not to be ridiculed?
>>
>>51505779
So what you're saying is you literally have no argument. Good shit.

>>51505771
Feels pretty fucking good. I'm treated with respect here. Wasting my time? I enjoy coming to work. Much more fulfilling earning my own money, supporting myself, you know, like an adult. Stay manchild.

>>51505798
Don't have a job as a programmer. Context, reading comprehension, git non-retarded.

>>51505728
No alienation. No insignificance, at all. Project and assume more.

I'm done entertaining lispfaggots now. You all have a wonderful day.
>>
>>51505743
Nice blog. How about elaborating on why "lisp is useless"? Can't? Oh, you don't actually know anything except the HTML you "created" 17 years ago? Figures.
>>
>>51505827
Your "ridiculing" is weak at best and will be forgotten by the end of my shift. You're the insignificant one here.

>>51505817
>trying to play the oldfag card
How'd you extrapolate that?
>>
>>51505842
Missed the part where I said I know C, hm? I didn't say that was all I knew either, but I'm not wasting my time "proving" myself to a) lisptards b) people in a thread who struggle with fizzbuzz.

On this note, I'm off to take an early lunch, maybe go for a walk, get paid for it; that ol' tune.
>>
>>51505846
>built a website almost 17 years ago while you were still probably swimming in your father's balls
???
you're acting as if you made one of the first websites from scratch and hosted the server yourself back in the 90's or someshit. if you had an angelfire website or someshit with copy-pasted javascript code that's nothing worth mentioning
>>
>>51505830
>>51505846
>treated with respect
>webfag
hahahahaha literally the trash of the industry
>don't have a job as a programmer
clearly, you're not good enough for it
>insignificant
yes, you are
>I know C
>struggle with fizzbuzz
bwahahahaahha, that's you level? no wonder you can't find a job as a programmer, htmlboy
>proving myself
what you've proven is that your shit; stay pleb
>>
>>51505876
I wrote the HTML myself and clearly stated I did not write the JS. At nine, seeing my site online was pretty great.

>>51505885
You can't read so our conversation is over.
>>
>>51505842
>How about elaborating on why "lisp is useless"?
>>51505871
>I said I know C
top lels (also, no, you don't know C, we can all see through your bullshit; try lying about javascript next time)
>>
>>51505902
how fucking fascinating. please, tell us more.
>>
>>51505902
>I wrote the HTML myself
such achievement! hahahahahaha
>>
>>51505902
>discussion on lisp
>I wrote the HTML
dem mad skillz tho
>>
>>51505930
What'd you do at nine? Experiment with your dicks at a best friends sleepover party?

Or maybe you turned on a computer one night after dreaming in code and churned out some Enterprise Yava software? Do tell.
>>
let it go
>>
>>51505959
>yava software
anon...
>>
>>51505974
Aight.
>>
>Go lacks muh generics
https://golang.org/doc/effective_go.html#type_switch
>>
File: amazeballz.jpg (5KB, 200x150px) Image search: [iqdb] [SauceNao] [Google]
amazeballz.jpg
5KB, 200x150px
>>51505902
>I wrote the HTML myself
>>
>>51505959
i made a website on a free hosting site for fun at like age 10 and each of my neopets had its own webpage faggot
>>
>>51505959
>at nine
>experiment with dicks
>best friends
>Yava software
this anon clearly has discovered the path to enlightenment :^)
>>
>>51505990
>I have selective reading issues!
>>
>>51506017
>HTML
>programming
ebin meme f᠎am
>>
>>51506079
Could you please point me to the post where I said HTML was programming as opposed to a mark-up language? Never mind. I see you're just shitposting. Have fun with that, champ.
>>
>>51506094
>programming thread
>lisp question
>muh html achievements
you dun goofed, weeb
>>
File: 1447802034726.webm (715KB, 600x338px) Image search: [iqdb] [SauceNao] [Google]
1447802034726.webm
715KB, 600x338px
>>51506017
>buttflummoxed
>>
>>51506116
Now you're assuming I like anime, which I absolutely don't.
You also must be the person who I've deemed unable to read, since my "html achievements" were in reply to probably you, who assumed I didn't know lisp/C/I'm not a programmer, assumed I'm a webfag, and assumed I only did CSS.

All you have are half-assed assumptions based on nothing to defend yourself mixed in with some ad hominem. It's great.
>>
>>51506145
you keep posting multiple line comments "bragging" about stuff you've "done" but can't write 2 sentences regarding a simple question on lisp; everyone can see you're full of shit and don't actually amount to much
>>
https://www.bento.io/grid

so which one? , anons
>>
>>51506145
>implying I know lisp and C
>not a word about lisp nor C programming
>shitposted half the thread about my html prowess
anon, this looks fishy...
>>
>>51506145
>csscuk
why live?
>>
enough
>>
>>51506168
>keep posting multiple line comments bragging
>literally mentioned one thing which keeps being addressed yet that's my problem it's being dwelled upon.

>>51506202
I don't even know CSS. When I had the slightest interest in making a webpage (and I only made one), CSS wasn't around.
>>
>>51506079
>Putting tags into a text file

Literally this desu senpai
>>
>>51506218
Nevermind, I was looking at counter-strike source.
Apparently CSS was around but I hadn't heard of it then. Only for a year or so it looks like.
>>
File: hmm, yes.jpg (34KB, 396x303px) Image search: [iqdb] [SauceNao] [Google]
hmm, yes.jpg
34KB, 396x303px
>>51506218
>I don't even know CSS. When I had the slightest interest in making a webpage (and I only made one), CSS wasn't around.
>>
>>51506248
>Nevermind, I was looking at counter-strike source.
oh shit nigger could you BE any more clueless
>>
>>51506262
I blame Google. Maybe my not paying attention a little bit as well.
Honest mistake which I corrected.
>>
>>51505755
What the fuck is it then? John McCarthy himself says as much in his 1960 paper about Lisp, Recursive Functions of Symbolic Expressions and Their Computation by Machine.
>>
>>51506315
It's multi-paradigm.
>>
All you guys constantly ridiculing web devs are acting like retards and need to grow up. Absolutely disgusting.
>>
>>51506462
I know you are but what am I?
>>
>>51506462
we ridicule all retarded faggots, not just web devs
>>
>>51506462
Well. At least I'm not a web dev.
>>
>>51504612
GC and massive binaries.
>>
>>51506544
Same as Java, C#, Go.
>>
>>51506325
What does that have to do with its foundation upon the Lambda Calculus?
>>
>>51506646
>functional
>>
>>51506620
Those are all shit as well of course.
>>
>>51505981
Well I spent 10 minutes typing up a response only to have a window pop up and backspace take me back a page. Fuck built-in keybinds. All programs should have fully user customizable keybinds.

Anyway, it isn't type safe. Imagine a func that takes two or more maps and performs a union on their elements with key precedence going to maps listed first. Well you could have the function declaration look like this:
 func mapUnion(a, b, map[interface{}]interface{}, ...map[interface{}]interface{}) (interface{}, error)
but there are problems with this. Well, the user must explicitly convert their maps to map[interface{}]interface{} before the function call. To alleviate this you can make the arguments just pure interface{}. Now what must be done by the function? It has to fist check that all parameters are maps and that all the maps have the same type (or you could do it so that if the types are different you put everything into a map[interface{}]interface{}, but that will be impossible to deal with as I'll get to).
Here's where shit gets gay. If you use the type switch you talked about you either 1) have to write a 400+ line type switch to deal with all the built-in types as both keys and values, AND not be able to cover any user defined types, or 2) use the reflect library which is slow and stupid unsafe.
Finally you have to return the finished map, which you can do as a map[interface{}]interface{} or as an interface{}. The second is better because you can just do a simple type assert instead of a copy and assert. However you can't just do that, you have to make the user checks the error before doing the type assert or you might be type asserting a nil, which is bad. And of course doing this precludes the ability to mesh maps of different types because the type of the map output is indeterminate unless you know the types of all the maps going in.

The entire process is shitty as fuck. Thank god that go generate exists so you can do template generics.
>>
>>51501368
nice bomb Ahmed
>>
>>51501368
hey, what are the 3 circles
>>
>>51506544
>>51506680
Then the "answer" doesn't answer the question. In case you're blind, the question was "Why doesn't /dpt/ use Common Lisp?"
In case you're an idiot, logic works this way:
/dpt/ uses Java, C# and Go.
/dpt/ doesn't use Common Lisp.
"GC and massive binaries" does not discriminate the two sets, thus is not an answer.
Wanna try again?
>>
>>51506743
Detonator buttons.
>>
>>51506771
c'mon, I had some electrical engineering
>>
>>51506743
Not him, but probably +1, -1, reset to 0.
>>
>>51506785
They are buttons. Do you think I would lie to you anon?
>>
for programming, I see
>>
File: C++vsObjC.jpg (62KB, 728x546px) Image search: [iqdb] [SauceNao] [Google]
C++vsObjC.jpg
62KB, 728x546px
>>51506544
>GC and massive binaries.
Garbage collection is much more optimised than the atrocious excuses for programs and libraries pumped out by C fanatics who don't understand that C must be treated with extreme respect in order to avoid anything from leaking memory to segmentation faults.

In fact, manual memory management with malloc() and free() directly is one of the least efficient forms available. There's a reason why applications where high control of memory is important, for example game engines, usually implement arena/zone allocators and deletion queues instead of throwing malloc() and free(), primitive instruments, all over the place.

Manually managing your memory today, without doing so only so you can implement a more advanced system atop (like the systems found in game engines,) or in situations like OSdev where you have no choice, is nothing more than cargo-cult posturing.

>>51506667
What is your point?
>>
>>51506843
>Garbage collection is much more optimised
Wrong. Stooped reading right there. Nice blog tho.
>>
>>51506843
>usually implement arena/zone allocators and deletion queues
Because they can, faggot! Try to do the same in your shit GC language.
>manual memory management let's you manually manage memory
Any more revelations, snowfag?
>>
Seems /dpt/ doesn't use Lisp because they're a bunch of retards than accidentally stumbled upon this thread while looking for /wdg/.
>>
>>51506913
"Nice blog" is a concise way to say "I'm a dumb shitposter"
>>
>>51507028
Nah, it's a concise way of saying "you're rambling again, sperg, if you need that many words for spewing drivel there's no wonder you can't learn anything and can't be taken seriously so I won't waste time bringing you counter arguments that you won't understand anyway".
>>
>>51506756
/dpt/ does not use Java,C# or Go.
Wanna try again?
>>
>>51507212
Is this your first day?
>>
>>51506843
>C must be treated with extreme respect in order to avoid anything from leaking memory to segmentation faults.
>usually implement arena/zone allocators and deletion queues instead of throwing malloc() and free(), primitive instruments, all over the place.
You're contradicting yourself you retard.
Implementing memory arenas is easy and makes memory management dead simple (and very efficient).
>>
>>51507212
>i thought this is the homescreen thread
f᠎am...
>>
>>51507230
Is it yours?
>>
>>51507262
my what, anon?
>>
File: 1436023689035.png (25KB, 252x223px) Image search: [iqdb] [SauceNao] [Google]
1436023689035.png
25KB, 252x223px
>>51501312
>>
>>51506997
>Because they can, faggot! Try to do the same in your shit GC language.

I already did. Specifically, I wrote a precise-tracing incremental garbage collector with copying for Valutron. I implement the core of the VM in Objective-C; I maintain my own Objective-C runtime library that includes a conservative tracing garbage collector, which is bypassed for much of Valutron since I have written a superior GC for its use, unconstrained by the limitations of the C memory model.

This is wildly different to "hurr durr i can use malloc and free directly lets use them instead of leaving the work to a library that knows better :D."

>>51506913
http://blogs.msdn.com/b/ricom/archive/2005/05/10/416151.aspx

Take a look here.

Note that, until Chen had wildly optimised his dictionary to a degree that is totally inappropriate for all but the very most performance-intensive applications, the garbage-collected dictionary had superior performance. I won't get too much into how this works, but it is probably a product of techniques like deletion queues (which allow the program to free a whole set of garbage at a convenient time, rather than inline one-at-a-time, which is slow) and generational collection (which is designed to allow the very quick freeing of objects that aren't used for long.)

>>51507252
What are you talking about? Of course implementing arenas is easy. It is also a style that is NOT suited to everything; good luck taking your average piecemeal-deallocating program and trying to convert it to the 'all-at-once' arena model! It really has to be designed with such paradigms in mind.
>>
Recommend me a new language

New
Old
Experimental

Anything.

I've been trying Lobster today, its pretty interesting. I'd be interested to see if anyone has done any performance testing with it.
>>
>>51507358
>It is also a style that is NOT suited to everything;
Yes it is.
>good luck taking your average piecemeal-deallocating program
You would never do that in the first place.

Actually even arenas are overkill most of the time, a large chunk of every day programs can get by with ZERO dynamic allocation (i.e allocate everything you need at startup statically, program runs to completion with no allocation/deallocation at runtime).
This is especially true on 64 bit platforms which has massive address spaces.
>>
>>51507424
Try Java
>>
>>51507424
brainfuck and ook.
>>
>>51507424
haskell
>>
>>51507424
Why don't you master one anon, knowing one or two languages real well is better paying than knowing 6
>>
>>51507358
>Valutron
Who? Ah, your toy shit that can't hold a candle to fucking javascript? hahahaha
>core of the VM in Objective-C
You already failed, faggot.
>my own Objective-C runtime library
hahahha; yo dawg, I pus a GC on your GC so you can randomly freeze while you randomly freeze
>limitations of the C memory model
Now you're just throwing buzzwords, you fucking baboon can't possibly know what a "memory model" is, much less the "C memory model".
>garbage-collected dictionary had superior performance
well memed
>>
>>51507358
>to a degree that is totally inappropriate for all but the very most performance-intensive applications,
This way of looking at things is why we have web browser which uses 2gigs of ram and chokes on low powered laptops, Visual Studio takes longer to cold start than my OS and despite the fact that computers have gotten several orders of magnitude faster the general computing experience has gotten more sluggish.

For people who care about software quality and the users experience, performance is ALWAYS important.
>>
>>51507468
I do know a language or two well. I just like trying new languages. I really want to try something that makes me think in a fundamentally different way and I think maybe I should actually try to learn >>51507466 instead of just messing around with it (because people often say it requires a different kind of thinking to program in it)
>>
>>51507539
don't learn haskell it's a meme language

learn elixir instead
>>
>>51507539
yp, it's more mathematical. is this language useful though
>>
>tfw no programmer bf
>>
File: 1447370649503.jpg (969KB, 1024x1467px) Image search: [iqdb] [SauceNao] [Google]
1447370649503.jpg
969KB, 1024x1467px
>Java "programmers"
>>
>>51507632
>lgbt invasion
>>
>>51507654
Just a brainwashed generation with little-to-no hope.
>>
>>51507654
what does a straight cis female wanting a programmer bf have to do with lgbt?
>>
>>51507698
Just because you wear your mother's bra and kneesocks and undergo HRT doesn't make you female.
>>
>>51507698
rule 30
>>
>>51507499
>toy shit
It's been turing-complete for a while now.

>You already failed, faggot.

Cry more. Sorry you don't like Objective-C

>randomly freeze
Do you really think that, after 5 decades of research, that would *still* be a problem in well-designed garbage collectors? Hint: it isn't.

>fucking baboon can't possibly know what a "memory model" is, much less the "C memory model".
Lol. You seem upset. Like many terms in computer science, it is overloaded with multiple definitions. In this instance, this baboon is referring to C's very low-level structure, the inability to discern pointers from integers, and the layout and existence of the stack. If you are an obsequious FizzBuzz champion like yourself, you would fail to immediately realise what is meant and start rattling out a random insult.

>well memed

Read for yourself.

>>51507531
Is that memory management to blame, or architecture? I would suggest the latter, of which memory management is just a component. Both Firefox and Visual Studio are huge and there are no doubt myriad ways they can be improved, and looking to their memory management is one approach.

That being said, I can't support optimisation until a program becomes totally incomprehensible and gains a large and confusing codebase except where eking out the final 2% gain is truly important.

>>51507448
>Yes it is.
No it isn't. Allocating memory in blocks that are released at once is not the right way for many situations where you need piecemeal control of data. That's not to say that there are projects that can benefit from arena allocators and projects that can't - in most projects of any size, there are areas where arena allocation is sensible. But it's not a panacaa.

>a large chunk of every day programs can get by with ZERO dynamic allocation

I don't disagree that many can. I don't usually write them. Most of my programs deal with indeterminate input and have no set point of termination.
>>
>>51507725
>projecting

>>51507729
are you 12 years old?
>>
>>51507758
I don't think you understand what projecting is.
>>
>>51503463
>all that boilerplate
>>
>>51507736
>It's been turing-complete
srs bsns
>*still* be a problem in well-designed garbage collectors? Hint: it isn't
what is HotSpot
>memory model
>overloaded with multiple definitions
no, you just don't know what you're talking about and want to sound fancy
>C's very low-level structure
>inability to discern pointers from integers
you don't know C
>layout and existence of the stack
no such thing in C
>memory management to blame, or architecture? I would suggest the latter
yes, architecture, like using a gc language
>final 2% gain
more like 50% gain over gc languages
>piecemeal control of data
not in gc languages
>my programs deal with indeterminate input and have no set point of termination
if you don't know that dynamic allocation is not required for that there's no wonder you're spewing so much ignorant crap
>>
>>51507785
"Psychological projection, also known as blame shifting, is a theory in psychology in which humans defend themselves against their own unpleasant impulses by denying their existence while attributing them to others."

either YOU don't understand what projecting is, or you have some serious difficulties with reading comprehension
>>
>>51507584
not that anon, nor do I know Haskell, so I'm talking out of my ass, but it's supposed to make you solve problems at a higher level before you start writing code. If that's true, it could benefit his coding in his primary languages.
>>
>>51507882
Precisely. Nice google definition since you clearly couldn't explain it without a reference.
I have no "unpleasant impulses" nor am I denying a want to be a sissy faggot. I was born male, I'll always be a male, and you're deluded to think wearing clothes and taking drugs changes what YOU'RE running from.
>>
>>51507886
idk, I've looked into it and it seems more mathematical, c++ seems more close to the machine.
eg. in Haskell you define an array of natural numbers [1,2,...] which is of infinite size and it's evaluated only when called
>>
>>51507634
have huge tits? I don't understand
>>
>>51507926
get ladies
>>
>>51507654
>lgbt invasion of a thread dedicated to a lgbt field
What, do you think Alan Turing and Grace Hopper were straight?
>>
>>51507916
>I have no "unpleasant impulses"
you obviously do if your first reaction to someone calling themselves cis was to claim the opposite

only someone obsessed with the idea would make such a challenge

>I was born male, I'll always be a male
sounds like denial to me
>>
>>51507970
faggot, or something?
>>
>>51508005
>sounds like denial to me
Sounds like acceptable, which clearly you're not used to
>first reaction
Look where you are and look at the flamboyant statistics. Assumption, sure; without reason? Absolutely not.
>>
>>51508011
uh?
>>
Did you all read Programming: Principles and Practice Using C++ by Stroustrup as someone first starting to get into programming?
>>
>>51508046
Acceptance*
>>
Sup, recommended reading for C#?
>>
>>51508076
http://learnxinyminutes.com/docs/csharp/
>>
what are the best "c for dummies" kind of websites
>>
>>51508076
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-ID309
>>
>>51508105
suicide://kil.l-yourself.read/a.book
>>
>>51503252
Listen to this guy
>>51504871

MVVM makes this so much easier.

Also for some extra fun try out prism with unity and make your stuff modular.
>>
>>51507736
>Allocating memory in blocks that are released at once is not the right way for many situations where you need piecemeal control of data.
What situations?
If you need tighter or hierarchical control you just nest them in a stack.
There's never a reason to have arbitrary allocations happening all over the place, that is just plain bad design from the start.
>>
>>51508046
that is definitely not what acceptance sounds like. there is literally no reason to be as defensive as you are, if it weren't for the fact that you find the reality of actually having these thoughts uncomfortable
>>
>>51507867

>no, you just don't know what you're talking about and want to sound fancy
I'd say that's the same of you

>you don't know C

But I do. I know it better than you, it seems - do you just write FizzBuzz all day?

0x1234
0x1234
Which is a pointer? Which is an integer?

>no such thing in C

I've never seen a C implementation that doesn't use a stack. The concept is thoroughly intertwined with C to the heart.

>yes, architecture, like using a gc language

No, FizzBuzzlord, that's not what I'm talking about. I am thinking instead about considerations like XUL, the process model, the system of IPC, the interaction of these.

>50% gain

Maybe. Maybe not. Maybe you'd get a 200% loss v.s. garbage collection. 50% is not a huge gain except in performance-critical areas, of course.

>not in gc languages

Yes with GC. Stop saying GC by the way - it betrays your lack of understanding as to what garbage collection is, because its implementation is rarely specified in detail in any language specification. Anyway, with GC it is possible for a single unreferenced object to be freed, rather than a whole arena. Many GCs use arenas as well and copy data out of them if necessary. It's a very complex algorithm usually and I won't bother trying to explain it fully.

>50% gain

Maybe. Maybe not. Maybe you'd get a 200% loss v.s. garbage collection. 50% is not a huge gain except in performance-critical areas, of course.

>not in gc languages

Yes with GC. Stop saying GC by the way - it betrays your lack of understanding as to what garbage collection is, because its implementation is rarely specified in detail in any language specification. Anyway, with GC it is possible for a single unreferenced object to be freed, rather than a whole arena. Many GCs use arenas as well and copy data out of them if necessary. It's a very complex algorithm usually and I won't bother trying to explain it fully.

>>51508164
Consider the representation of contacts in an instant messenger.
>>
>if you don't know that dynamic allocation is not required for that there's no wonder you're spewing so much ignorant crap

You are the one spewing ignorant crap. I doubt you've ever written anything other than FizzBuzz. Maybe a Sudoku solver at most.

How do YOU propose to solve this problem? Don't say 'use static pools' because they cannot cope with indeterminate memory usage, and you would implementing a dynamic allocator, however crude, atop these. Don't say stack allocation either - the stack is, in fact, much like a stack of arenas, from which you may dynamically allocate memory.
>>
>>51508100
Thanks
>>51508147
Nope
>>
>>51508198
>Which is a pointer? Which is an integer?

A pointer and integer are synonymous in C.
>>
Is it okay to write macros for malloc() and fopen() that print an error if they return NULL?
>>
>>51508198
>Which is a pointer?
none of them
>Which is an integer?
both of them
>I've never seen
you haven't seen a lot of stuff
>concept is thoroughly intertwined with C
not at all
>Maybe you'd get a 200% loss v.s. garbage collection
will never happen
>50% is not a huge gain
that's what all gc fags say
>Stop saying GC
>it betrays your lack of understanding as to what garbage collection
gc = garbage collection; it's a shorthand, you moron
>copy data
slow
>a very complex algorithm usually
slow
>Don't say 'use static pools' because they cannot cope
they can
>from which you may dynamically allocate memory.
you have no idea what you're talking about
>>
>>51508249
They're not. Stop teaching him garbage if you don't know C either. His knowledge is already fucked up, don't make it worse.
>>
>>51508262
You can do whatever the fuck you want. You can write macros for "return" and "+" if you like.
>>
>>51507736
>Is that memory management to blame, or architecture?
Memory management is certainly a huge factor because that's the part which hasn't really gotten faster (in fact it's actually gotten slower relative to cpu speed, back in the day a memory fetch would just be a cycle or two, now it's dozens or up to hundreds of cycles, (but of course in raw numbers memory is faster today))
The other big factor is of course nested interpreters interpreting other interpreters (be it a full vm or some data format being converted to/from), it's truly insane how many levels of indirect execution you have to slog through to draw a single pixel of a 'modern web site' (I mean fucking hell, people have started using javascript to decode and render images, certain inline image viewing/expansion pegs a full fucking core to render it slow as hell, whereas opening in a new tab is instant and barely any cpu usage at all)
>>
I've got a weird question: Is there some place/website where only handsome programmers are allowed to post?
>>
>>51508249
>A pointer and integer are synonymous in C.
WTF?
>>
>>51508307
>>>/hm/
>>
>>51508307
Yes. You don't qualify though.
>>
>>51508289
How are they not synonymous? (apart from integers being signed)
>>
>>51508358
Read a book, nobody has time to teach you the basics of C. You'll also find out how you can add two numbers and print the result on the screen.
>>
>>51508198
>Consider the representation of contacts in an instant messenger.
That's a candidate for static preallocation, or at the very least no need to ever deallocate (just keep allocating and forget about it).
Having thousands of contacts is pathological.
>>
>>51508358
Integers (ints) and pointers are also of different size.

>>51508379
>You'll also find out how you can add two numbers and print the result on the screen.
But can you calculate the average of two ints?
>>
>>51508379
It sounds to me like you don't know what the fuck you're talking about.

>>51508407
Integer =/= int
>>
>>51508358
int i = 1;
i += 3; // this is allowed and adds 3 to 1

void* p = (void*) 1;
p += 3; // this is not

int* ip = (int*) 1;
ip += 3; // this is allowed and adds sizeof(int) * 3 to 1
>>
>>51508432
>Integer =/= int
Doesn't matter, pointer types are different from integer types (long long, long or short).
>>
>>51508407
>Integers (ints) and pointers are also of different size.

They MAY be of different sizes. Regardless, the numbers originally posted are both capable of being ints or pointers.
>>
>>51507634
>tfw no huge-titted qtπgf
>>
>>51508500
>They MAY be of different sizes.
No, they MAY be of the same size.

The only guarantee you have is that ints are at least 16 bits. Pointer size, on the other hand, is completely implementation specific.

>Regardless, the numbers originally posted are both capable of being ints or pointers.
Literals are irrelevant. See >>51508449

Integer types do not behave in the same way as pointer types, because they aren't the same thing.
>>
>>51508432
>It sounds to me like
You don't have enough knowledge for an informed opinion. What it "sounds" to you is irrelevant.
>>
>>51508268
>>51508316
>>51508289

Actually, they both may be either a pointer or an integer.

What I have discovered here is that none of you know how a computer works. I don't care about the type system here because it is totally irrelevant once the code has been compiled. Both void * p = 0x1234 and long p = 1234 have the same representation in memory on all but the most byzantine of architectures (it may not be the case on 16-bit DOS). Now, try and deny that.

You know, why am I even trying to tell you this? This is basic knowledge. It's so basic that academic articles on garbage collection reference it casually reference it (The Magpie Source-to-Source Transformer ensures that "[...] no integers or dead registers will accidentally or maliciously retain the object.") https://www.cs.utah.edu/plt/publications/ismm09-rwrf.pdf
Note that this article describes a tool that preprocesses C source code so that their precise garbage collector can differentiate pointers and integers.

>will never happen

See the Chen dictionary.

>gc = garbage collection; it's a shorthand, you moron
Whoops. I had meant to say 'gc language' there. You should've guessed that from the following sentences. Too bad FizzBuzzlords can only remember one word at a time.

>slow
No. Very fast thanks to decades of research and development.

>>51508305
I can't disagree with you. The modern browser has become an extremely complex virtual machine, really.

>>51508407
Integer doesn't mean int. An int is one type of integer.
>>
>>51508407
>can you calculate the average of two ints
Yes.
>>
>>51508449
>>51508539
Whoops, you missed the point. The compiler is not the runtime representation in memory.
>>
>>51508500
>the numbers originally posted are both capable of being ints or pointers
Wrong.
>>
>>51508571
>Actually, they both may be either a pointer or an integer.
No, actually they're both literals, not a type. You assign the literal to a type, but the literal is just a literal.

>Both void * p = 0x1234 and long p = 1234 have the same representation in memory on all but the most byzantine of architectures (it may not be the case on 16-bit DOS). Now, try and deny that.
It doesn't matter. The fact that it can be different on one system means that they are not the same. That's the whole point of standardising stuff in the first place, so that what is defined on one system is also defined on the other.

>Integer doesn't mean int. An int is one type of integer.
Weasel words. long long ints, long ints or short ints, doesn't matter. They're not pointers.
>>
>>51508598
>Whoops, you missed the point
I think not.

>>the numbers originally posted are both capable of being ints or pointers
This is wrong


What you mean are values. Integers, floating points, addresses, they're all values when it comes to representation in memory. But when you're talking about types (ints, pointers, etc), you're in the domain of C (not computer architecture).
>>
>>51508571
>they both may be either a pointer or an integer
wrong
>none of you know how a computer works
keep telling yourself that
>I don't care about the type system
of course, you don't understand it
>Both void * p = 0x1234 and long p = 1234 have the same representation in memory
they dont
>all but the most byzantine of architectures
64-bit windows is not "byzantine"
>This is basic knowledge
imagined
>Whoops. I had meant to say
yeah, I bet you meant to say a lot of stuff but you still posted only garbage
>No. Very fast
you forgot your medication?
>An int is one type of integer.
first correct thing you've posted
>>
>>51508571
€50 on this dumb poster being a transethnic haloniggress turbofemme woman "programmer"
>>
>>51508571
>Both void * p = 0x1234 and long p = 1234 have the same representation in memory
No they don't.

1234 = 0x4d2
0x1234 = 4660

Also, the number of preceeding 0s also matter. A pointer type must be as wide as an address (word), the long p must only be at least 16 bits (meaning you can fit it into a halfword).
>>
>>51508623
Meaningless distinctions don't matter. This topic came up when I was discussing the implementation of garbage collectors in C.

And the fact that it can be the same on one system means that they are the same for all practical purposes. The point is that I cannot precisely differentiate a pointer from an integer, because in memory, they tend to look the same. In fact, the same problem applies even if pointers *are* stored differently to integers, because since I can't tell what a certain memory location stores (pointer or integer), I can't tell if what I've found is an integer that happens to have the same value as the pointer, or an actual pointer.

>>51508672
>wrong
Not wrong. Learn something other than FizzBuzz.

>they dont
They do on most platforms. It's an assumption central to the operation of Boehm GC. UINT_PTR exists for a reason, by the way.

>imagined

No. Basic knowledge.

>yeah, I bet you meant to say a lot of stuff but you still posted only garbage

What I posted made more sense than your whining tripe. Go back to making FizzBuzz faster.

>you forgot your medication?
Ableist insults because you've been cornered. Nice work.

>>51508721
Whoops. I forgot to prepend 0x to 1234 in the second case. Anyway, this assumption works on systems that use the LP model, which is most.
>>
>>51508571
> Both void * p = 0x1234 and long p = 1234 have the same representation in memory on all but the most byzantine of architectures
64-bit Windows is a byzantine architecture? (on that platform, pointers are 64-bit, "long" is only 32-bit).
>>
>>51503355
You know, since your social group is nonexistent you are still a pretty little snowflake because of your mad programming skills. No need to fear other people on here.
>>
>>51508764
>The point is that I cannot precisely differentiate a pointer from an integer, because in memory, they tend to look the same.

In memory literally everything looks exactly the same.
>>
>>51508764
>Meaningless distinctions don't matter.
They're not meaningless, the distinctions are there because they're not the same thing.

>And the fact that it can be the same on one system means that they are the same for all practical purposes.
But that's massively wrong. They're not even the same on the system you're currently using.

>The point is that I cannot precisely differentiate a pointer from an integer, because in memory, they tend to look the same
The difference is in the size. An integer can be a bit, a nibble, a byte, a halfword, a word.

An address on the other hand, can only be a word (unless you're using some super weird architecture where addresses are of variable length [yes these do exist]).

But the point is, it doesn't matter how it looks in memory. What does matter is what is defined in C and what isn't. In C (as in the fucking specification of the language), ints are not the same as pointers. long long ints are not the same as pointers.

>In fact, the same problem applies even if pointers *are* stored differently to integers, because since I can't tell what a certain memory location stores (pointer or integer), I can't tell if what I've found is an integer that happens to have the same value as the pointer, or an actual pointer.
Telling the difference is easy. One contains a legal address that the program is allowed to access, dereferencing the other on the other hand leads to unspecified or undefined behaviour.
>>
>>51508764
Your whole argument is basically that when loaded into memory everything is just 0s and 1s, therefore nothing exist because you can't tell them apart.

You have to be the stupidest person to post in a /dpt/ ever.
>>
>>51508764
>They do on most platforms
I see you skipped the 64-bit windows part
>UINT_PTR exists for a reason
only on windows
>No. Basic knowledge.
you don't have that
>Whoops. I forgot
you keep "forgetting", are you sure about that medication thing?
>Anyway, this assumption
so now it's just an assumption
>>
Question:

in C11, what's the best way to check if a variable is NOT NULL?

is if(variable) sufficient?
>>
>>51508878
underrated post
>>
>>51508878
This
>>
>>51508914
Yes.
>>
How people store data more complicated that 2 strings in key-value db?
>>
>>51508914
I have a pointer which is : 0x0000000000000b

The pointer, which i access like this: ptr->hi, i already made NULL earlier

however when I do if(var) and if(var != NULL), it still passes through
>>
>>51508972
Then it's not null

> 0x0000000000000b
>b
It's not null
>>
>>51508764
>I cannot precisely differentiate a pointer from an integer
sounds like your problem; C on the other hand, can, because pointers are not integers
>>
>>51508972
post the code that doesn't work
>>
>>51508969

that is a bit vague, can you give some examples?

they store JSON / serialized data in the value. which ends up being interpreted as real data types

there are also column-based stores like cassandra.
>>
>>51508837
Yes. Luckily in languages like Smalltalk this isn't a problem because the garbage collector knows the memory layout and can hence determine what is a pointer - without having to perform any horrible and unportable tricks.

>>51508854

Thank you for a thought-out reply.

>They're not meaningless, the distinctions are there because they're not the same thing.

They are meaningless to me when I want to write a garbage collector. That's why I (as well as Hans Boehm and others) had to go with a conservative design, where any word-aligned word that represented as uintptr_t has the address of allocated memory, is assumed to point to that allocated memory.

>But that's massively wrong. They're not even the same on the system you're currently using.

They are. FreeBSD x64.

>But the point is, it doesn't matter how it looks in memory. What does matter is what is defined in C and what isn't. In C (as in the fucking specification of the language), ints are not the same as pointers. long long ints are not the same as pointers.

But it does matter. The language specification on the other hand does not. This is because the language specification's word isn't going to tell my garbage collector if something is a pointer or an integer.

>Telling the difference is easy. One contains a legal address that the program is allowed to access, dereferencing the other on the other hand leads to undefined behaviour.

The integer can be a legal address. This was a big problem with Google Golang on 32-bit machines, because there were often such cases. On the other hand, a pointer can hold a value that isn't legal. This part isn't a problem for GCs unless there's some devilish arithmetic being performed and it's interrupted.

>>51508878
That's the fucking point. My whole argument is about what matters if you're writing a garbage collector for C. Because writing a garbage collector is all about looking at what's been loaded into memory. Too bad you have such a short memory.
>>
>>51508999
>>51509009

what is the b?
>>
>>51508914
how fucking hard is it to write != null? if(variable) is false even when for instance int is 0, most types probably dont even have the unary operator for that. Also if it is null doesnt it just crash at that?
>>
>>51508764
>pointers are integers
>I cannot precisely differentiate a pointer from an integer
>I can't tell if what I've found is an integer that happens to have the same value as the pointer, or an actual pointer
you also can't differentiate an integer from a string or a struct or an array; by your logic, integers are strings?
>>
>>51508878
>Your whole argument is basically that when loaded into memory everything is just 0s and 1s, therefore nothing exist because you can't tell them apart.
Not him, but that is indeed the case.
It's why you can never drop-in a 100% correct GC into a C program because there's no way you can scan memory and know if something is a pointer to the heap, pointer to the stack or just some arbitrary integer or object data that happen to have the same bit pattern as a valid pointer.
You have to instrument all allocations with your own little tag system and then tell the users to only use those tagged allocators for ALL memory allocations, if they ever call malloc() (or some OS or 3rd party library api which allocates memory themselves) then the GC will potentially cause a false-positive or false-negative somewhere.
>>
>>51509023
>I want to write a garbage collector
you don't have enough knowledge to do that
>FreeBSD x64
actually OSX, don't lie, applecuk
>writing a garbage collector for C
you're an idiot
>>
>>51509023
>They are meaningless to me when I want to write a garbage collector.
Then your approach to garbage collection is stupid. Most people use reference counting.

>They are. FreeBSD x64.
Pointer type = 64 bit
Int type = 32 bit
Long long it = 64 bit
Short int = 16 bit

Clearly, integers and pointers are of different sizes.

>The integer can be a legal address.
Yes, and a random string can be a valid password... What's your point exactly?

>This was a big problem with Google Golang on 32-bit machines, because there were often such cases. On the other hand, a pointer can hold a value that isn't legal. This part isn't a problem for GCs unless there's some devilish arithmetic being performed and it's interrupted.
You obviously have no idea of how garbage collectors are implemented

HINT: They do NOT search memory for random pointers, they keep track of reference counts.

>That's the fucking point
Then you are stupid.

> My whole argument is about what matters if you're writing a garbage collector for C.
WTF are you on about? See above.

> Because writing a garbage collector is all about looking at what's been loaded into memory.
No, you fucking don't retard.

C++ garbage collection = using RAII to implement reference counters
Python garbage collection = reference counters
Java garbage collection = reference counters + breadth first search
>>
>>51509058
>why you can never drop-in
why would you do that?
>>
>>51509031
A hex value.

>>51509058
>You have to instrument all allocations with your own little tag system
But that's how ALL garbage collectors are implemented.

>if they ever call malloc() (or some OS or 3rd party library api which allocates memory themselves) then the GC will potentially cause a false-positive or false-negative somewhere.
You know you can hook in calls to malloc, right? You know that's how valgrind works?

I swear, if people only ventured outside Windows for two fucking seconds, they would know a tad more about how computers work.
>>
>>51509058
char *mypointer = malloc(size);
my_C_GC_release_control(mypointer, size); //atomic
my_C_GC_regain_control(mypointer, size); //atomic
free(mypointer);


How would this not work? It might be cumbersome and error-prone, but I don't see why it wouldn't work.
>>
>>51509031
11 in hexadecimal
>>
>>51509058
>It's why you can never drop-in a 100% correct GC into a C program
But you can without scanning memory...

How do you think valgrind keeps track of all your allocated and free'd bytes?
>>
>>51509121
>>51509110

I have an array of struct instances.

What is the proper way to free/delete the struct instance so it's at a default state?
>>
>>51509136
he doesn't know about valgrind, the cuk lies about being on freebsd and using UINT_PTR from the win32 api
>>
>>51509116
Hell, GNU extensions even support this

__attribute__((cleanup))
>>
>>51509110
>But that's how ALL garbage collectors are implemented.
Yeah but if you actually built it into the language's memory model (and don't expose raw pointers) it's a solved problem, no user data can ever accidentally become an alias to a heap pointer because the language has full control over everything.

>You know you can hook in calls to malloc, right? You know that's how valgrind works?
That doesn't help you at all.
The problem is not recording all instances of malloc() being called, it's figuring out when you can actually free something, and that means you need to know whether a certain address is 'alive' or not. And if some arbitrary data happens to show up as the bit pattern of a currently existing pointer you have created a false alias and will keep it alive even when it's supposed to be dead.
>>
>>51509136
valgrind is not perfect, does not catch all memory leaks.
And it definitely can't tell you WHEN (as in at what wall clock moment) it's safe to free something or not (which is the main problem a GC has to solve).
>>
>>51509206
>no user data can ever accidentally become an alias to a heap pointer because the language has full control over everything.
You can never safe guard against idiot programmers. I can access raw pointers in Java too by using the misc.sun.unsafe package and make the GC start freeing parts of the JVM and crash the JVM itself... What's your point?

>The problem is not recording all instances of malloc() being called, it's figuring out when you can actually free something
REFERENCE COUNTING
ffs
>>
>>51509206
>if you actually built it into the language's memory model
then you'd get a language with slow implementations, like all languages with gc
>>
>>51509223
>valgrind is not perfect, does not catch all memory leaks.
Because no real-life implementation of anything is actually perfect.
>>
>>51509240
your mom is perfect
>>
>>51509116
>but I don't see why it wouldn't work.
It's been explained already.
C allows a user to create a pointer to any arbitrary address at any time, and eve worse, any arbitrary integer (or object data) can take on the bit pattern of a valid pointer, which means you'll trip the GC up when it comes to tally reference counts.
>>
File: blush.png (7KB, 191x234px) Image search: [iqdb] [SauceNao] [Google]
blush.png
7KB, 191x234px
>>51509251
Y-yours too
>>
>>51509240
In other words: valgrind-type functionality is not sufficient for implementing a working GC for C.
Just as I initially said.
>>
>>51509278
>In other words: valgrind-type functionality is not sufficient for implementing a working GC for C.
But it is

Perfect GC != working GC

You want some magic functionality that safe-guards agains programmers doing all sorts of arbitrary pointer stuff. Well, no language offers protection against this.
>>
File: snapshot23.png (305KB, 1920x1080px) Image search: [iqdb] [SauceNao] [Google]
snapshot23.png
305KB, 1920x1080px
>>51509081
First, I've already written two garbage collectors. One for Objective-C, one for Valutron (a Lisp).

Second:
>>51509169
>actually OSX, don't lie, applecuk
Ok, see pic related though.

>you're an idiot
Ok

>>51509090
>Most people use re ference counting.
I don't care to check the statistics but I find that dubious.

>Clearly, integers and pointers are of different sizes

int may be short for integer, but it has a different meaning. An int is just one type of integer. A long is 64-bit, like a pointer on FreeBSD x64.

>You obviously have no idea of how garbage collectors are implemented

It seems the one who has no idea is you.

From Golang FAQ:
>The current implementation is a parallel mark-and-sweep collector.

Mark and sweep literally means "look through the roots memory, if you find a pointer then mark the object it points to as living and now look through that object's memory.". In some languages, you can differentiate what addresses may contain pointers and what may not. In C, one has to scan the whole stack and assume anything that has a value representing the address of an object is a pointer. This is elementary. It is not even controversial. Boehm GC, TinyGC use this model directly; Golang and others use variations.


Regarding Valgrind, since it literally runs your program in what essentially constitutes a virtual machine, it doesn't seem relevant.

>>51509259
^ This guy is true.
>>
>>51509228
>You can never safe guard against idiot programmers.
This is not about idiot programmers.
extern uintptr_t x;
x = rand();
// x might now contain the same bit pattern as a heap pointer

The point is that there's NOTHING you can do to account for things like that.

> I can access raw pointers in Java too by using the misc.sun.unsafe package and make the GC start freeing parts of the JVM and crash the JVM itself.
Exactly.

>REFERENCE COUNTING
Do you even know how that actually works?
>>
>>51509301
>A long is 64-bit, like a pointer on FreeBSD x64.
That's wrong.

A long is 32. You mean long long.

>Regarding Valgrind, since it literally runs your program in what essentially constitutes a virtual machine, it doesn't seem relevant.
Yeah, VMs are totally not relevant when you're talking about virtualizing memory and doing elaborate garbage collection by memory inspection....

Retard
>>
>>51509288
>But it is
Not even close.
>Perfect GC != working GC
You can't even create a working GC.
>You want some magic functionality that safe-guards agains programmers doing all sorts of arbitrary pointer stuff.
That's basically the point of a GC.
>Well, no language offers protection against this.
Language without arbitrary pointers does.
>>
>>51509301
That browser reminds me of Netscape Navigator.
>>
>>51509317
>using rand to generate a pointer address
>not about retarded programmers
That's the worst example ever.
>>
>>51509344
>You can't even create a working GC.
Valgrind is basically memory virtualization. Of course you can use this to create a working GC.

>Language without arbitrary pointers does.
Neither Python nor Java has arbitrary pointers, it's still possible to circumvent the language internals and trip the GC.
>>
>That's wrong.
>A long is 32. You mean long long.

FreeBSD is an LP platform. That means longs are 64-bit:
$ cat > test.c
#include <stdio.h>
int main()
{
printf("%d\n", sizeof (long));
return 0;
}
$ cc test.c
test.c:4:16: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
printf("%d\n", sizeof (long));
~~ ^~~~~~~~~~~~~
%lu
1 warning generated.
$ ./a.out
8


>Yeah, VMs are totally not relevant when you're talking about virtualizing memory and doing elaborate garbage collection by memory inspection....

Running your whole program in a virtual machine is totally different to periodically scanning the stack and allocated memory for things that look like pointers. Valgrind has a severe performance impact; the state-of-the-art Boehm-Demers-Weiser Garbage Collector for C and C++ does not.
>>
>>51509317
>uintptr_t
That's not standard C.

>it's merely optional in C99
>>
>>51509381
>state-of-the-art slow-as-fuck used-by-nobody
well, then
>>
>>51509386
>not standard C
it is; you don't know what "standard" means
>>
>>51509350
Are you retarded or do you not understand the example?
uintptr_t was just to make a suitable integer type, and rand() was just a simple example. Could be ANY function generating ANY integer value.
Could be just any int on a sizeof(int) == sizeof(pointer) platform.
errno is a global int always available which can ruin your day.
>>
OOP question; say I have this example code:

# python example code
class Spell(object):
def __init__(self, name, damage):
self.name = name
self.damage = damage

class FireBall(Spell):
def __init__(self, name, damage, x1, x2, # and 99 more....):
super(Fireball, self).__init__(name, damage)
self.x1 = x1
self.x2 = x2
# and 99 more

def y1(self):
pass
def y2(self):
pass
def # 99 more:
pass


I'm making FireBall() a child of Spell(), and FireBall() inherits everything from Spell() and makes each of those variables different for every child I make. Spell() only creates very few variables, while FireBall(), and other childs of it, create a large amount of variables/functions. Is it even worth it to have parent class like this, when it only does very few things, and they're all going to be overwritten for each child? Would it be fine just to delete Spell(), and just put those few variables in every class that would have inherited them? Or should I stick with the is-a thing and put those few variables in a parent class?
>>
>>51509440
that's why no sane person tries to jam a gc on c or c++
>>
>>51509369
>Valgrind is basically memory virtualization. Of course you can use this to create a working GC.
valgrind can't even catch all memory leaks, it wouldn't have a chance to serve as a GC.

>Neither Python nor Java has arbitrary pointers, it's still possible to circumvent the language internals and trip the GC.
Keyword being 'circumvent' i.e you escape into unsafe blocks or FFIs.
All of those are isolated on a language level (either via special syntax or as a special library) and can be statically removed from the source code.
>>
>>51509440
But making an arbitrary pointer is literally idiot programmers.

>>51509386
>>51509430
It is standard, you just can't expect it to work.

>>51509381
Pic
>>
>>51509514
>But making an arbitrary pointer is literally idiot programmers.
You can't write a non-trivial C program without arbitrary pointers.
>>
File: 006.jpg (4MB, 2467x3484px) Image search: [iqdb] [SauceNao] [Google]
006.jpg
4MB, 2467x3484px
C noob here, when should I malloc? I haven't used it yet since valgrind never said I have a memory leak.

Any good resource explaining it in detail?
>>
>>51509593
When you need it. You're welcome.
>>
>>51509514
Are you on a 32-bit platform? The only platforms I know using the LLP64 model (which means a long integer is 32-bit and a long long integer is 64-bit) are Windows.

>But making an arbitrary pointer is literally idiot programmers.

The memory representation of an arbitrary number can match that of a legal pointer.
If your program counts to ~4 billion on a 32-bit system then it will have had, in its counter variable, a potential valid pointer for every address at some point. There will be no way for the garbage collector to tell whether that's an integer or a pointer.
>>
>>51509556
You don't need to free all arbitrary pointers, only when the pointee data is no longer pointed at. That's fairly easy to figure out, but OH NOEZ YOU CAN'T VIRTUALIZE MEMORY BECAUSE MUH ARBITRARY DISTINCTIONS
>>
>>51509612
What is your actual problem that made you type all this drivel for half a thread? That C doesn't have GC and you can't handle malloc/free? Pick another language, moron!
>>
>>51509612
>Are you on a 32-bit platform?
No

>The only platforms I know using the LLP64 model (which means a long integer is 32-bit and a long long integer is 64-bit) are Windows.
>>
File: Untitled.png (10KB, 437x464px) Image search: [iqdb] [SauceNao] [Google]
Untitled.png
10KB, 437x464px
>>51509514
>[email protected]
lewd, jonas.
pic related, mfw.
>>
>>51509514
long is at least 32 bits, not exactly 32 bits. it's 32 bits on your system and 64 bits on the other guy's system. don't be obtuse

>But making an arbitrary pointer is literally idiot programmers.
he's not making an arbitrary pointer he's making a random integer which a dumb mark-and-sweep gc could mistake for a pointer, even though it isn't one
>>
>>51504612
everyone on /dpt/ who keeps hyping Lisp doesnt understand Lisp. Lisp is a metaprogramming language language, its a DSL for making DSLs. People who try to apply Lisp to bullding static applications are idiots. The most general use any Lisp could be used for is scripting.
>>
File: thanks.jpg (92KB, 400x400px) Image search: [iqdb] [SauceNao] [Google]
thanks.jpg
92KB, 400x400px
>>51509669
it's even lewder if you consider that I name my computers after Calvin and Hobbes characters

>mfw fantasizing about little susie derkins
>>
>>51509638
>only when the pointee data is no longer pointed at. That's fairly easy to figure out,
It's impossible to figure out with C's memory model.
>>
>>51509701
It's not.

>keep track of calls to malloc, store what it returns
>zero out memory that your GC frees
>when no aligned (because pointer aliasing) pointer-sized value contains the address, make your GC free it
>>
>>51509660
The only reasonable explanation remaining is that Apple Clang is producing 32-bit binaries by default, given that OS X is an LP64 architecture.

>>51509647
>le I Am So Leet Because I Use Malloc/Free Explicitly meme

your code is probably slower than the equivalent garbage-collected version, sorry. You just can't beat 50 years of GC research and development that easily. That's why the brightest minds like John McCarthy and Alan Kay went with GC.
>>
File: 1447355747287.png (766KB, 800x1050px) Image search: [iqdb] [SauceNao] [Google]
1447355747287.png
766KB, 800x1050px
>>51509737
>You just can't beat 50 years of GC research and development that easily.
>>
>>51509701
>C's memory model.
you keep using those words without knowing what they mean
>>
>>51509737
>your code is probably slower than the equivalent garbage-collected version
it's not
>You just can't beat 50 years of GC research and development
I do it everyday
>John McCarthy and Alan Kay went with GC.
they don't care about performance
>>
>>51509736
>It's not.
It is.
>when no aligned (because pointer aliasing) pointer-sized value contains the address,
This is the part that's impossible.
Your GC is currently sweeping at 0x1000, it sees this:
  addr     value
[0x1000]: 0x12345
[0x1004]: 0x12345

Which is the pointer, which is the integer (or float, or array of bytes, or some 4 byte struct, etc)?
>>
>>51509737
>The only reasonable explanation remaining is that Apple Clang is producing 32-bit binaries by default, given that OS X is an LP64 architecture.
>>
>>51509800
I know exactly what it means.
>>
>>51509852
If that'd be true, you wouldn't be using it in the wrong context all the time.
>>
In LLDB, why is my debugging printing the memory address of the object.

but when I print and array, it's structured perfectly.

how can i make it so a pointer correctly prints like it should, with the structure,, in lldb?
>>
>>51509902
>you wouldn't be using it in the wrong context all the time.
I haven't.
>>
>>51509918
You did, everywhere.
>>
>>51509931
Nope.
>>
>>51509851
how curious
>>
>>51509851
>LC_SEGMENT_64

Yes, it would be. Now please compile with the -m64 flag to specify generation of 64-bit code.
>>
>>51509937
Where did you talk about threads?
>>
>>51509937
Mods. It's time to call it on this guy. Better clean up.

He knows too much.
>>
>>51509947
Indeed. Maybe I have some weird default flags?

>>51509949
Do you see the virtual addresses it loads the segment into, that is clearly a 64-bit address

Also, have the rest of the output.
>>
>>51509968
>threads
Ah, its you who appear to now know what memory model means.
>>
>>51509994
But I do, I said threads. Your surprise upon hearing this shows your knowledge on the subject.
>>
>>51509976
>>51509949
>>
>>51509994
protip: memory model doesn't mean "representation of objects in memory"
>>
>>51509968
>>51510007
>>51510028
#REKT
R
E
K
T
>>
>>51510007
>But I do, I said threads.
Which means you don't know what it means.

>>51510028
No one has said that.
>>
>>51510056
>I don't know what "memory model" means
>they are nice buzzwords so I keep mentioning them
>>
>>51510087
Is that a projection?
>>
>>51510056
What do you think "memory model" is?
>>
>>51510056
>Which means you don't know
But I do, I said threads.
>>
>>51510104
>>51510087
>>51510056
>>51510028
>>51509994
>>51510007
>you go first! i know what it means, but do you?!
>>
>>51510099
>meme arrows
>projection
how new can you be, m8?
>>
>>51509949
>>51509737
Well? >>51510011
>>
>>51510118
one of them said it has to do with threads and wikipedia at least seems to support that, the other keeps rambling about gc in c and c++ and throwing the words around from time to time without explanations "gc is hard because memory model"
>>
>>51510104
What kind of addressing modes there are, whether code and data are stored separately, segmentation or flat address space, and things like size of pointers.
We're not talking about memory models in the context of multi threading of atomic operations and happens-before type stuff, but in the hardware/software architectural context since it's a GC we're talking about.
>>
>>51510154
>kind of addressing modes there are, whether code and data are stored separately, segmentation or flat address space, and things like size of pointers
Those are not "memory model". You can call them whatever you want, though, but it's not accepted terminology for them. Memory model means something else to the entire programming community. Why not call them "banana"? That doesn't have an established meaning yet in programming.
>>
>>51510154
>C memory model
>addressing modes
>code and data stored separately
>segmentation
>flat address space
none of those have anything to do with C; how can they be called "C memory model"?
>>
File: memory_models.png (75KB, 659x356px) Image search: [iqdb] [SauceNao] [Google]
memory_models.png
75KB, 659x356px
>>51510189
>Those are not "memory model".
Yes they are.
>You can call them whatever you want, though, but it's not accepted terminology for them.
See excerpt from Intel Manuals.
>Memory model means something else to the entire programming community.
It has two widely accepted contexts, "setting the memory model" for x86 asm programmers means things like tiny huge flat, rip-relative (which corresponds to x86 memory models, size of pointers, whether segmentation is on or not and if addresses should default to PC relative or not), etc.

You're welcome for having been educated.
>>
>>51510154
>not talking about memory models in the context of multi threading of atomic operations and happens-before type stuff
that's literally what memory model is, you dumb fuck
>>
>>51510257
>Intel Manuals
>x86 asm
That's not C; definitely not "C memory model".
>having been educated
On what? "C memory model"? Hardly, seeing you don't know what the fuck you're talking about.
>>
>>51510257
>c memory model
>intel assembly manuals
>maximum backpedaling
>maximum damage control
>>
You can't create a proper GC for C using

>>51509386
It is standard C. Even if optional.
>>
itt: gc cuk getting told hard by c pros
happens every time
/thread
>>
>>51510317
>>51510299
>>51510258
>>51510200
>>51510189

Maximum samefaggotry

>inb4 "no" and fake screenshot
>>
>>51509381
>>51509514
>%lu
undefined behaviour faggot.
It's %zu, holy shit.
>>
>>51510200
They have to do with the implementation of a GC.
A flat address space + unrestricted raw pointers means you cannot distinguish heap pointers from some other arbitrary data.
(C doesn't require flat addresses of course, a C implementation on a segmented memory model could have potentially have a working GC, although not on x86 because it's not quite enough since segment selector:offset pairs can overlap)
>>
>>51510353
see >>51510347
it's over, webfag
>>
Anime app because I'm too lazy to constantly open kiss anime
>>
>>51510381
>on a segmented memory model
no such thing
>>
File: 1447327735484.jpg (50KB, 338x600px) Image search: [iqdb] [SauceNao] [Google]
1447327735484.jpg
50KB, 338x600px
>>51510365
>C99
>>
>>51510299
>That's not C; definitely not "C memory model".
It's a C implementation.
>On what? "C memory model"
On the two meanings of 'memory model', you though there were only one (having to do with threads, which I knew of as well of course)
>>
>>51510382
>it''s not samefaggotry because I samefagged one more time
>>
>>51510400
for pre-C99 you have to do something like printf ("%lu\n", (unsigned long int) sizeof (long));
And still not be sure if it is correct (in case size_t is bigger than unsigned long int). Uncasted versions are undefined behaviour.
>>
>>51510397
x86 has a segmented memory model.
>>
>>51510408
>It's a C implementation.
And? Still not "C memory model".
>>
>>51510408
>I knew of as well of course
anon, if you knew, you wouldn't have said >>51509994

inb4: PRETENDING
>>
>>51510408
>IA-32/x86 is a C implementation
I'm none of the people you are responding to, but what the actual fuck anon?

GCC is a C implementation
Clang is a C implementation

x86 is an architecture
>>
>>51510433
>C memory model
>>
>>51510437
It would be the C memory model on that implementation.
And on the software side of the architectural memory model you have things like the layout of stack, heap, globals, read-only data, etc.
>>
>>51510424
>>51510365
>undefined behaviour
No, it's "implementation-defined". Read the standard.
>>
>>51510473
>C memory model
no; the C memory model is about threads and shared access to data; it's the same on all implementations
>>
>>51510473
The C memory model is defined on the standard anon.
>>
>>51510440
>anon, if you knew, you wouldn't have said >>51509994 (You)
That's exactly why I said "ah", as in - I know you were probably gonna mention threads.
>>
>>51510473
>layout of stack, heap, globals
no such thing in C
>>
>>51510441
gcc or clang compiling C for x86 would have to follow those memory models.
>>
>>51510479
You read the standard you fucking cocksucker. Passing wrong types to the wrong formattings is undefined behaviour.

What is implementation-defined is the size of size_t.
>>
>>51510493
>"ah", as in - I know you were probably gonna
you said "ah" after the fact, faggot, there's no "probably gonna"
you got told. hard.
>>
>>51510500
I'm talking about implementation details here.
>>
>>51510527
>C memory model
just no
>>
File: smug-fucker.jpg (21KB, 460x276px) Image search: [iqdb] [SauceNao] [Google]
smug-fucker.jpg
21KB, 460x276px
>>51509381
>>51509612
>>51509737
>>51509949
>>51510365
>>51510511
>make claim about architecture and C implementation
>can't explain >>51510011
>"hurr durr it's undefined behaviour anyway"

Typical /g/ autism
>>
>>51510473
>architectural memory model
This faggot just loves these buzzwords. Well done, anon, well done.
>>
>>51510519
>you said "ah" after the fact, faggot, there's no "probably gonna"
Nope.

There's absolutely no need to be upset, I've educated you all of something you were ignorant of.
Just take it in and move on.
>>
>>51510557
>C memory model
how about no
>>
>>51510548
>can't explain >>51510011
Explain what?
>>
>>51510539
We've always been talking about how to implement a GC for C, keep up.
>>
>>51510557
>I just found out "memory model" means something else
>welp, better act smug anyway
m8...
>>
>>51510548
>>51510511
Admit that you were wrong and fuck off, or explain it, instead of back-pedalling and going on about undefined behaviour.
>>
>>51510553
It's sad that you're so resistant to new information.
>>
>>51510586
then stop using words that have nothing to do with neither gc nor c
>>
>>51510596
Wrong about what?
Back-pedalling about what? Are you fucking dense?
Explain what?
>>
>>51510594
Another projection?
Because that's literally what you're doing here.
>>
>>51510608
>new information
>C memory model
hahahahaha
webcuks actually believe this
>>
>>51510582
>"LP platform means 8 byte longs on 64-bit"
>long is 4 byte
>can't explain it and goes on about 32-bit binaries, flags and now undefined behaviour

>>51510615
>pretending to be someone else
How original...
>>
>>51510615
>C
>memory
>model
>>
>>51510632
Was I asked to explain anything you little shit? Kill yourself.
>>
>>51510666
>muh memory model
>>
>>51510660
>quoting random people
>>
>>51510666
>Was I asked to explain anything you little shit? Kill yourself.
Uh, yeah?

>>51510140
>Well?
>>
>>51510682
>Uh, yeah?
When?

>>51510676
Yep, a retard.
>>
>>51510679
3 words:
C... memory... model...
>>
>>51510613
Do you now even know what a GC is?
The memory model has everything to do with implementing a GC, its job is pretty much managing the details of the memory model.
Anyone implementing a GC has to be intimately familiar with both the hardware memory model and the language memory model (which the GC is being implemented in), and of course the days GC have to work in multi threaded environments, so even if you wanna willingly misinterpret the context of how 'memory model' as been used I've still been right from the start.
>>
>>51510697
>I got told
we know, anon, we know
>>
>>51510697
>When?
I even quoted and linked the post for you, are you blind?
>>
>>51510718
>no (you)
Consider killing yourself.
>>
>>51510676
>muh data structures
>MUH ALGORITHMS
>>
>>51510713
>the memory model has everything
>of the memory model
>hardware memory model
>language memory model
no "C memory model", anon?
>>
>>51510730
>pretending to be another person
How original.
>>
>>51510739
See >>51510730
>>
>>51510713
>I've still been right from the start
>C memory model
>segmentation
hahahaha
>>
>>51510750
See >>51510632
>>
>>51510737
If you write the GC in C you of course need to adhere to the C memory model or you'll have undefined behavior.
>>
>>51510713
>and of course
>so even if
>I've still
damage control: the 3 strikes
>>
>>51510784
>damage control
Nice meme.
>>
>>51510765
>muh backpedaling
>muh "difficult because of C memory model"
>I don't know the C memory model is defined in the standard document and it's the same for all implementations
>I confuse intel manuals with C specification
>webfag really
>>
>>51510803
don't be butthurt anon, it's not the first time you get told and certainly not the last
>>
>>51510596
Considering no one ever wanted to talk about OS X (I run FreeBSD and asserted correctly that FreeBSD x64 uses 64-bit length long integers) you're lucky anyone's gratifying you at all.

Quite frankly I have no interest in your compiler. OS X on 64-bit systems is an LP64 system (source: Intel C++ 14.0 manual, http://www.wrgrid.group.shef.ac.uk/icebergdocs/intelv14docs/en_US/compiler_c/main_cls/GUID-9475ACAF-D093-4E94-8CA4-B7068621A3C8.htm ) and I don't care if you can get the wrong value somehow.

This has got to be the most desperate damage control I've ever seen. You guys were totally obliterated on the difference between pointers and integers, and proceeded then to be wrong about how tracing GCs work, how integer as a term relates to int and long, and now the size of a long on 64-bit OS X. It's astonishingly bad. Just give up and stop clutching at straws; it'll only hurt more if you keep this up.
>>
>>51510818
>>51510629

>accuses others of being webcuk
>needs a third party library to average two ints
>>
>>51510850
>third party library to average two ints
but anon, I dont
>>
>>51510841
>I don't care
You mean you don't know.
>>
C# horrors

Why is event system such a spaghetti shit? The syntax is horrible, the way around it is horrible and illogical.
>>
>>51510596
>back-pedalling
Oh look, it's that shitposter again.
Long time no see.
>>
>>51510841
>run freebsd
>screenshot names confirm osx
anon...
>>
>>51510871
Then you're not a webcuk but a big dick C boss
>>
>>51510886
>Long time no see
long long
>>
>>51510886
>Oh look, it's that shitposter again.
Who do you think I am?
>>
>>51510833
I've never been 'told'.
This is not debate club or a competition anon-kun, you don't score points if you think you've zinged someone (it's especially silly to act this way since this is an anonymous forum).
Clarifications are not 'backpedaling' or 'damage control', it's just responding to someone who apparently misunderstood your point or didn't get it.
>>
>>51510897
correct terminology is "big dick C playa"
>>
>>51510911
lol'd

>>51510929
oh, i will get it right next time
>>
>>51510923
>Clarifications are not 'backpedaling' or 'damage control'
They are when you go from "C memory model" to "x86 memory model". That's literally the definition of backpedaling!
>>
>>51510919
The "backpedaling" faggot. Still got no new vocabulary I see.
>>
>>51510923
>I've never been 'told'
You got told on "C memory model". It doesn't mean what you thought. It's defined in the standard document for the C programming language, not in the Intel reference manuals.
So: told.
>>
>>51510841
>be wrong about integer type size
>"oh but i meant longs, longs are integers too fuck you"
>be wrong about sizeof long as well
kek

>I run FreeBSD and asserted correctly that FreeBSD x64 uses 64-bit length long integers
I'll believe you when you post screenshot instead of copy paste.
>>
bamp for ebin /dpt/
>>
>>51510965
Can you be more specific? Specific topic? Thread? I'm fairly sure I'm not the only one using a common word such as backpedaling/back-pedaling.
>>
478 replies
>>
File: bump.png (119KB, 439x256px) Image search: [iqdb] [SauceNao] [Google]
bump.png
119KB, 439x256px
>>51510994
>bumping when the thread is autosaging
>>
>>51511013
you dun goofed
>>
>>51510894
How do they confirm OS X? >>51509301 was saved directly from KSnapshot of Trinity Desktop.

>>51510878
Both statements apply. I don't know and I don't care.

Another note: 'memory model' means 'memory model'. It's quite clearly a context-dependent term. Those who object are politely instructed to leave the thread immediately and never come back.

>>51510976
Integer means integer. It does not mean int. Longs are indeed integers. So are shorts. I'm not interested in why someone is getting sizeof long = 4, I don't know and don't care. I have already provided a reliable source for my claim. You haven't.
>>
>>51511019
stfu or I'll bamp with traps next time
>>
>>51510944
Backpedal from what?
I've originally always been talking about the issues of implementing a GC for C.
In this context it's the issue of how raw pointers with a flat address space works that makes it impossible to create a drop-in GC for an arbitrary C program.
Prior to C11 "C memory model" would refer to exactly these kinds of points (just google it, put -c11) there are papers written about "C memory models" which have nothing to do with threads but things like pointer aliasing and object/type representations.

A Precise Yet Efficient Memory Model For C - Electronic Notes in Theoretical Computer Science (ENTCS) archive
Volume 254, October, 2009

A Formal C Memory Model Supporting Integer-Pointer Casts - Jeehoon Kang, Chung-Kil Hur, William Mansky et al

Is this when I'm supposed to go "LELELEL REKT FAGGOT!!!!!!!!!"?
>>
>>51511037
>'memory model' means 'memory model'
How about "C memory model", anon? You know, the one you "got told" about.
>>
>>51511059
>Is this when I'm supposed to go
You have nowhere to go, you're in full damage control mode.
>>
>>51511037
>I don't know and I don't care.
Unlike you I'm not content with not knowing.

>Integer means integer. It does not mean int. Longs are indeed integers. So are shorts.
Exactly, so assuming that an integer type is large enough to hold pointer types is non-portable and results in unspecified or implementation-defined behaviour.

>Integer means integer. It does not mean int. Longs are indeed integers. So are shorts. I'm not interested in why someone is getting sizeof long = 4, I don't know and don't care. I have already provided a reliable source for my claim. You haven't.
What claim?

All I'm saying is that you falsely assumed that long types are large enough to hold pointer types on all architectures (except 16-bit DOS as you said in >>51508571)

I've provided more than my share of evidence proving it isn't so.
>>
>>51511059
>I know I got rekt like fuck
>here's some worthless references of dudes that also used the term wrong, don't use the standard document for that!
>this makes me right
>>
>>51511084
I've explaining all the issues regarding GCs for C and cited two scientific papers.
You post memes and green texts.
>>
>>51511120
>C memory model
yo got rekt on that t᠎bh
>>
>>51511141
Nope.
>>
>>51511141
>no desu
Did Jackie 4chan remove word filters?

kek desu senpai
>>
>>51511059
>I've originally always been talking about the issues of implementing a GC for C and incorrectly used the buzzwords "C memory model" and got my ass handed to me after that
ftfy
>>
>>51511116
There's literally no reason to be upset.
Given you tons of helpful information, take it in, read those papers, read up on Boehm GC (specifically its limitations), maybe you'll learn something and become a better programmer.
>>
>>51511159
but... you literally did
>>
>>51511200
>read those papers
when are you gonna read the C standard? because, you know, "C memory model"
>>
ITT and the last couple of /dpt/s

>We /prog/ now

mental midgets and toilet scrubbers has been replaced with webcuks and rekt

jews has been replaced with SJWs

racket has been replaced with haskell

ENTERPRISE QUALITY has been replaced with poo in loo
>>
>>51511238
C... memory... model... tho!
>>
>>51511238
>/prog/
http://bbs.progrider.org/prog/
>>
>>51511294
We got 750+ in a thread a few years ago.
>>
>>51511314
>>51511294
Not exactly surprising

It's just a bunch of autists fighting over semantics
>>