Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
david2ndaccount
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
david2ndaccount
4mo ago
Use the new standards-conformant preprocessor with `/Zc:preprocessor` https://learn.microsoft.com/en-us/cpp/build/reference/zc-pre...
2.
▲
by
david2ndaccount
6mo ago
Pascal strings might be the only string design worse than C strings. C Strings at least let you take a zero copy substring of the tail. Pascal strings require a copy for any substring! Strings should be two machine words - length + pointer
3.
▲
by
david2ndaccount
7mo ago
The world won’t allow a dependence on a single geopolitically threatened entity in the long run, so either they defuse that risk themselves or risk a competitor filling that role. This move is better for TSMC itself.
4.
▲
by
david2ndaccount
9mo ago
If you want to remain portable, write your code in the intersection of the big 3 - GCC, Clang and MSVC - and you’ll be good enough. Other implementations will either be weird enough that many things you’d expect to work won’t or are forced
5.
▲
by
david2ndaccount
9mo ago
You can apply `#` to __VA_ARGS__, which won’t preserve the exact whitespace, but for many languages it’s good enough. biggest issue is you can’t have `#` in the text.
6.
▲
by
david2ndaccount
10mo ago
I wrote a similar article in the past: https://www.davidpriver.com/ctemplates.html I use this technique in my hobby projects as it has worked out the best for me of the options I’ve explored.
7.
▲
by
david2ndaccount
11mo ago
Works with MSVC if you add /Zc:preprocessor (to get a standard compliant preprocessor instead of the legacy one).
8.
▲
Samsung Fridge's New Update Gives You Ads While Tracking Your Food
(howtogeek.com)
2 points
by
david2ndaccount
11mo ago
|
0 comments
9.
▲
by
david2ndaccount
1y ago
The author relies on the compiler fitting the bitfield in unused padding bytes after “speed”, but that is implementation-defined behavior (almost everything about bitfields is implementation defined). MSVC will align the unsigned bitfield t
10.
▲
by
david2ndaccount
1y ago
C23 has _Float16
11.
▲
by
david2ndaccount
1y ago
Summer reading programs are a band-aid on the problem that children shouldn’t have such a long summer break now that air conditioning is common. Spread the breaks out throughout the year if you want to maintain the same number of days off.
12.
▲
by
david2ndaccount
1y ago
> We immediately began disclosure of this issue once we realized the potential impact. Unfortunately, no disclosure contacts were publicly available and we had to resort to emailing random people. The Paradox.ai security page just says t
13.
▲
by
david2ndaccount
1y ago
The “typeof on old compilers” section contains the code: (list)->payload = (item); /* just for type checking */\ That is not a no-op. That is overwriting the list head with your (item). Did you mean to wrap it in
14.
▲
by
david2ndaccount
1y ago
In D, you can just do a static foreach over a sequence to generate case labels: https://d.godbolt.org/z/PxWEW14K1
15.
▲
by
david2ndaccount
1y ago
Don’t ignore food addiction, the app turns into a button you can press on your phone and in a bit you’ll have a dopamine hit from the food. You don’t have to get dressed or confront the reality of your situation.
16.
▲
by
david2ndaccount
1y ago
That’s not the point of hello world. It’s not to be as small a valid program as possible. It’s to be a small program that also exercises the needed functionality for using the tool usefully. All of the exercises following that hello world n
17.
▲
by
david2ndaccount
1y ago
Tabs are a control character and have no business being in a text file. Do you use ascii record separator characters too?
18.
▲
by
david2ndaccount
1y ago
You’re switching to the build system of a different, pre 1.0 programming language that has frequent breaking changes?
19.
▲
by
david2ndaccount
1y ago
This does actually look a lot better. Using the inspector to toggle it on and off, “pretty” does look a lot prettier.
20.
▲
by
david2ndaccount
2y ago
Backslash is a valid path character (you can use / or \ as the path separator on windows) so if the backslash isn’t actually escaping anything it is left as-is.
21.
▲
by
david2ndaccount
2y ago
let not thy left hand know what thy right hand doeth
22.
▲
by
david2ndaccount
2y ago
If you’re interested in this, I wrote a blogpost on a simple c hash table without deletion. https://www.davidpriver.com/c-hash-table.html
23.
▲
by
david2ndaccount
2y ago
Without a non-linear activation function, chaining perceptrons together is equivalent to one large perceptron.
24.
▲
by
david2ndaccount
2y ago
You can have methods with NamedTuple
25.
▲
by
david2ndaccount
2y ago
I wrote a blogpost describing this technique. https://www.davidpriver.com/ctemplates.html
26.
▲
Life, death, and retirement
(randomascii.wordpress.com)
320 points
by
david2ndaccount
2y ago
|
166 comments
27.
▲
by
david2ndaccount
2y ago
Somewhat a reference to https://wiki.c2.com/?ThreeStarProgrammer
28.
▲
by
david2ndaccount
2y ago
Only msvc provides strcpy_s and they don’t conform to the standard. Other libcs don’t provide it. Ignore everything from Annex K and write your own wrappers around memcpy. You should always know the size of your buffers.
29.
▲
by
david2ndaccount
2y ago
Use memcpy and do the size check yourself beforehand (taking the appropriate action if it doesn’t fit). Avoid any function starting with str except for strlen. Prefer pointer+length instead of relying on nul-terminated strings.
30.
▲
by
david2ndaccount
2y ago
The correct thing to do is to use memcpy and to know the size of both the destination buffer and the source buffer. If the source buffer won’t fit, then you need to take an application-specific action (is truncation ok? do you have to abort
More ›