Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gallier2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
31.
▲
by
gallier2
5y ago
If it is only the tone that bothers you, maybe you should abstain from programming C. ;-)
32.
▲
by
gallier2
5y ago
No, version control is not simple, never was. git was the first vcs that didn't suck because it was the first tool that understood the nature of the problem. All others were ass backward and instead of solving the problem stood in the
33.
▲
by
gallier2
5y ago
The only visual git tool I really like is gitextensions for windows.
34.
▲
by
gallier2
5y ago
and the ultimate option for git lg is --reflog. Seeing all branches, even the old ones that do not exist anymore is a eye opening event in discovering the true nature of git: it never changes a commit, ever.
35.
▲
by
gallier2
5y ago
In most places it uses int for string and buffer sizes lengths. It wouldn't surprize me if 2GiB of data could trigger several overflows.
36.
▲
by
gallier2
6y ago
DSP's have often uncommon sizes. tms320c5502 for example has following sizes: char-- 16 bits short --16 bits int --16 bits long-- 32 bits long long -- 40 bits float-- 32 bits double -- 64 bits
37.
▲
by
gallier2
6y ago
The XOR trick has also the disadvantage of being 3 dependend instructions that can not overlap. The one with a temp variable has only 2 of them dependend and can therefore save one cycle on an OO CPU.
38.
▲
by
gallier2
6y ago
Foreach macros. Nice when you have a list of constant that you need for declaring a lot of tables or enumerations. Here an example with ISO-639 language codes Example with 3 "values". This is the base definition from which all the
39.
▲
by
gallier2
6y ago
Rarely used feature that I quite like is defining function types. typedef bool foo_fn(int, char); This declares a type of a function. foo_fn foo1, foo2, foo3, foo4; This declares 4 functions of the same type. It's equi
40.
▲
by
gallier2
6y ago
The question is also to consider when and at what price. A Amiga 2000 had indeed quite the extension possibilities, but they were expensive. An Amiga 500 was a whole other story. The expandibility was limited and only in later times was it
41.
▲
by
gallier2
6y ago
Indeed. As a student (1987) I had an Amiga 500 and after a few months I sold it and bought an Atari Mega ST2 in its place. The Amiga was so unpleasant to use for programming. To be confortably usable it required at least 2 floppy drives (a
42.
▲
by
gallier2
6y ago
Atari STE had 2 channels 8 bit DAC à 25kHz on DMA. It was the Falcon who had incredible sound capacity with its matrix channel mixer and DSP.
43.
▲
by
gallier2
6y ago
Did you see that the article is from 2009?
44.
▲
by
gallier2
6y ago
The D language still gives access to x87 code. The language defines a type called real which is supposed to give access to the highest precision the implementation allows, on x86 it is the x87 with its 80 bits. On other platforms it's
45.
▲
by
gallier2
6y ago
> A type is much denser, than a textual description, and in most >cases sufficient. In feeble languages with simpleton typesystem may be, but in highly generic templated language like D it is not the case. The type is not dense at all
46.
▲
by
gallier2
6y ago
> because being able to write down types is really quite important to me. The issue arises only with generic heavily templated functions. Nothing in D forbids you to write your programs with all types explicitly written down. That's
47.
▲
by
gallier2
6y ago
> The language needs fixed so it can express its own types. The language expresses its types just fine (it's in the mangled name in the object file). The issue is that there is no point in the human readable form of these types.
48.
▲
by
gallier2
6y ago
> That should not be a problem. It is a problem in D because of a lacking in D. It is not a problem, the compiler copes with it. The problem comes from the fact that such a type is absolutely not interesting to know how it is written. Th
49.
▲
by
gallier2
6y ago
No. It is known at compile time. Template declarations in D take 2 parameter lists. The first is the template parameters the second the runtime parameter: in auto whatDoesItReturn(int i)() { static if (i == 0) { return int.init; } else { re
50.
▲
by
gallier2
6y ago
No need for that, any Rust program is obfuscated.
51.
▲
by
gallier2
6y ago
The initial intent was to add 2 hex values, but using 0xfffe tripped the parser.
52.
▲
by
gallier2
6y ago
clang will warn as it doesn't like int+string constructs. &"Yes\0No"[!x>>2]; // same number of characters to shut it up.
53.
▲
by
gallier2
6y ago
!!x is idiomatic. (bool) cast is modern. I use !=0 in only one context, if(strcmp(a,b) != 0) to check if two strings differ. Normally if an if() expression I don't check explicitly for 0 or not 0, except for strcmp class of functions,
54.
▲
by
gallier2
6y ago
You can also typecast to bool since C99. (bool)x if you include <stdbool.h> or (_Bool) if not.
55.
▲
by
gallier2
6y ago
because ternary operation is a Rvalue only in C. In C++ and as gcc extension it can be used as Lvalue, but not in regular plain C.
56.
▲
by
gallier2
7y ago
You can also write verbose code in D. The language doesn't prohibit it.
57.
▲
by
gallier2
7y ago
git log --reflog --all is the more important imo than git reflog
58.
▲
by
gallier2
7y ago
NO. Nothing is gone after commit. You just don't see it. Make a git log --reflog --all and you will see all the commits you made (or rebase made) in the last 3 months. You can than rescucitate an old branch by simply putting a branch n
59.
▲
by
gallier2
7y ago
You have a branch named <branchname> you do your operation that fouls up your branch. If you check with git log --reflog --all you will see with this magical command that git DOESN'T REMOVE any commit. Your old tree is still ther
60.
▲
by
gallier2
7y ago
Since C11 there's _Generic which allows to do it. Using macros in that case is strongly advised (or else it would be very verbose).
More ›