Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gsg
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
30 ms
·
241.
▲
by
gsg
14y ago
I'm not sure I understand. Function calls work the same way in every call by value language: the binding of an argument to a value is the same as the binding of a variable or the assignment of part of a data structure. That's a pretty clear
242.
▲
by
gsg
14y ago
I see, people were mistaking the different nature of values in C and Python for a difference in calling semantics.
243.
▲
by
gsg
14y ago
> They want to know if function arguments are call by value or call by reference (neither). My knowledge of Python is limited, but I was under the impression that it is call by value just like everything else (where Python's notion of
244.
▲
by
gsg
14y ago
Rasterisation doesn't require any real acceleration structures. There are various caches, but nothing comparable to a kd-tree or BVH.
245.
▲
by
gsg
14y ago
Ray tracing enjoys a ridiculous amount of inherent parallelism. That's not much of an advantage though, since rasterisers also enjoy a ridiculous amount of inherent parallelism. Large scale "render farms" that exploit both already exist and
246.
▲
by
gsg
14y ago
I've heard of several: http://embed.cs.utah.edu/ioc/ http://code.google.com/p/c-semantics/ Haven't used either in anger though.
247.
▲
by
gsg
14y ago
Yep, that's the price of simplicity and safety. People talk a lot about stack allocation, but the same issue of pointerful vs flat representation arises in arrays and records, where it presents even more of a performance issue. Some GCed la
248.
▲
by
gsg
14y ago
Why not? It's a bit more limited than I thought at first, basically only suitable for the output of gcc -S (highlights labels that look like .Lxxx). https://gist.github.com/4546274 There's no license or documentation, it's flaky and proba
249.
▲
by
gsg
14y ago
Agreed. I have a flaky emacs hack that colours labels to make it easier to correspond branch with target, but arrows are considerably nicer.
250.
▲
by
gsg
14y ago
Certainly has some of objdump's quirks. 8d bc 27 00 00 00 00 => lea 0x0(%edi,%eiz,1),%edi. I was half expecting a disassembler written in Javascript.
251.
▲
by
gsg
14y ago
Without yielding useful information, const annotations can't hope to have any positive effect on compiler optimisations, fancy or not. I agree that const is useful for the other reasons you mention.
252.
▲
by
gsg
14y ago
Constness of pointer or reference parameters has no optimisation effect because it doesn't convey any reliable information. It doesn't indicate whether the thing is written to in the body of the function (the compiler already has that infor
253.
▲
by
gsg
14y ago
Constness of parameters has zero effect on optimisation. Const declarations may provide a small benefit. Go ahead and apply const as you see fit, but don't expect better code out of it.
254.
▲
by
gsg
14y ago
Aliasing is not really an architecture specific concern. Furthermore the vast majority of languages allow free aliasing, differing from C in what things pointers are allowed to point at and not in the number of pointers which may point at t
255.
▲
by
gsg
14y ago
Seems to me that the GP was referring to the C abstract machine but used a similar, more common phrase by mistake. Granting that, I can't say I agree with his point: C has probably ran on more machines than any other language. As an abstrac
256.
▲
by
gsg
14y ago
* * curr Unfortunately the spaces seem to be unavoidable.
257.
▲
by
gsg
14y ago
Some of C's syntax is distinctly kooky, particularly declarations. By way of illustration, my two favourite C declarations: const struct strange typedef volatile; typedef evil; Or the following, in which the struct tag is a for
258.
▲
by
gsg
14y ago
Allocating memory on initialisation is a bit questionable. It's better to alloc no memory and let the growth logic handle that case (either by checking for zero or by including an offset, such as vec->capacity += vec->capacity + 2).
259.
▲
by
gsg
14y ago
In file A, #include "foo.h", parsed once. In file B, #include "foo.h", parsed once (again). In file C... Include guard optimisations do not solve this problem.
260.
▲
by
gsg
14y ago
The function trick suffices to handle objects with stack-shaped lifetime (certainly a very common case), but it does not suffice when resources are associated with parts of a data structure. The strength of RAII is that it handles both of t
261.
▲
by
gsg
14y ago
Common Lisp has a bunch of these kind of operators defined "variadically": equality, relational and arithmetic ops, min, max, gcd, lcm, etc.
262.
▲
by
gsg
14y ago
Seems to be broken in Firefox 16.01 (Linux). I get the title screen. 'x' or return will take me to a map screen, at which nothing happens except music playing.
263.
▲
by
gsg
14y ago
It's not all about the quality of the compiler. C compilers have to deal with a language that has terrible semantics for aliasing, and in which cross module information flow is usually limited to what programmers type into header files (alt
264.
▲
by
gsg
14y ago
Given a pointer to an object, remove from an intrusive list is three memory accesses: only tiny vectors will give faster operations than that. Insertion favors intrusive lists even more: allocation and copy free!
265.
▲
by
gsg
14y ago
There's a better trick: point the link structure at itself. This avoids any need to test for null.
266.
▲
by
gsg
14y ago
Then for deletion you need to traverse every data structure in which you store said pointers.
267.
▲
by
gsg
14y ago
If you read the article with more sympathy, you will notice that he is using RAII, I think rather cleverly, to automate removal of an object from the intrusive lists contained within it. This is a interesting improvement over the venerable
268.
▲
by
gsg
14y ago
Linked lists are appropriate when you need (usually multiple) sequences of pointers to objects: thus, the real alternative is not vector of t but vector of pointer to t. A vector of pointers gives no contiguity advantage over an intrusive l
269.
▲
by
gsg
14y ago
You forgot insertion and removal, which intrusive lists provide in constant time and vectors do not. If you can own the objects, linked list (of any kind) is usually not appropriate. The essence of the efficiency of an intrusive linked list
270.
▲
by
gsg
14y ago
Vector is a fine data structure, but doesn't do the same job. The purpose of intrusive linked lists is to provide constant time, allocation-free insert/remove from multiple sequences that all refer to the same object (identity, not value),
More ›