HackerTrans
TopNewTrendsCommentsPastAskShowJobs

properparity

no profile record

comments

properparity
·2 yıl önce·discuss
Yep, that's how the world works.

Politicians only starts caring about peoples problems if they are either personally effected or one of their close friends/benefactors are effected.
properparity
·2 yıl önce·discuss


  Vector* vector_create(size_t itemSize) {
    Vector* vec = (Vector*)malloc(sizeof(Vector));
    // ...
    return vec;
  }
This just immediately strike me as poor code.

C is not java, you do not have to "new" up every little structure.

  void vector_init(Vector *v, size_t itemSize) {
    v->itemSize = itemSize;
    // ...
  }
Instantly cleaner, more efficient, less memory allocation/handling needed, lets the user control where the Vector is stored.
properparity
·3 yıl önce·discuss
A capacitor is a few extra cents on the bom which is a no go for profit maximizing companies.
properparity
·3 yıl önce·discuss
What exactly is it that costs so much money when it comes to space stuff?

Is the materials, exotic and rare stuff?

Do you need custom microchips/fabs or something?

Is it the engineer salaries, thousands of highly paid people times N years?
properparity
·3 yıl önce·discuss
If an AI is ever capable of replacing a human programmer it would also be capable of replacing a manager and running its own company.

So why would you even be in a position to hire anyone?

In fact why are you working at all? The robots are doing everything already. Just sit back and relax, enjoy the matrix.
properparity
·3 yıl önce·discuss
My findings as a spartan C programmer:

I've been using a simple unity-build ad-hoc build.bat/build.sh "system" for years now, works wonders.

YAGNI will serve you well, 99.99999(repeating)% of everyone's code will only be built and run on 1, maybe 2 platforms, why bother with these insane monstrosities that we call 'build systems"?

The few times I've needed to build for a new platform I just wrote that build script then and there, took a few minutes and that was it.

Modern machines can churn through a tens if not hundreds of K lines of C code in less than a second, so incremental builds aren't needed either (and if anything, with too many translation units you end up with linking being a bottleneck).

Single TU benefits:

- Global optimizations "for free".

- Make all functions static (except main) and you get --gc-sections "for free".

- Linking is blazingly fast.

- Don't have to bother with header files.

- No one has to download anything to built my code, I make it work on a default msvc/gcc/clang install (i.e if you have gcc, cl or clang in your path when running build.bat/build.sh, it will build).
properparity
·3 yıl önce·discuss
>This would prevent integer operation reordering as an optimization, leading to slower code.

The sane way to address that is to add explicit opt-in annotations like 'restrict'.

  #push_optimize(assume_no_integer_overflow)
  int x = a + b;
  // more performance orientated code
  #pop_optimize
  // back to sane C

  #push_optimize(assume_no_alias(a, b), assume_stride(a, 16), assume_stride(b, 16))
  void compute(float *a, float *b, int index)
  {
   // here the compiler can assume a and b do not alias
   // and it can assume it can always load 16 bytes at a time
   // the programmer has made sure it's aligned and padded to so with any index
   // there's always 16 bytes to load
   // so go on, use any vectorized simd instruction you want
  }
  #pop_optimize
  // back to sane C
properparity
·3 yıl önce·discuss
But why put in unreachable? Doesn't make any sense to me.

If a branch is truly not supposed to ever happen, why have a branch at all? Just remove that code from the source entirely- that helps the optimizer even more, because the most optimal code is of course no code at all.
properparity
·3 yıl önce·discuss
That is something a decent type system should solve - make it impossible to pass 'incomplete values' on, so any state further on which depends on the error handled/not handled will expect the appropriate type and compiler will error at that call site.

An unused variable means you weren't passing it on anywhere so there is no code which depends on its value, so how can it be a bug?

future = x.do_async(); return;

should not error out because of 'unused variable', it should give a error message concerning the lifetime of the future object.
properparity
·3 yıl önce·discuss
How?

By making text flow to 100% of the width you can easily resize the browser window for everyone's perfect reading width.

I usually run my browser tiled to 50% of the screen, the new design wastes a lot of space at that size (you have to shrink to really narrow width before it enters 'mobile mode' and uses 100% of the width again - I mean it's pretty insane, you can see more text at say 30% width, but at 40%-60% it pops out that useless white space padding on the left leading to a narrower effective text width)
properparity
·4 yıl önce·discuss
Yes like errno, except not global of course, you add one per struct/context/module/thread/whatever. And you design the functions to early return if the error state is set.

>how do you know which call introduced the error first?

You rarely care about that but if you do you either make the error state stick to the first error, or as I said, make it a list you can append multiple errors to.
properparity
·4 yıl önce·discuss
You don't have to code like that in Go, C or other languages without exceptions or fancy option-type sugar.

A sensible thing that often works great is to have a sticky error state (either a single int, or list of stuff you append to) then you just keep calling functions which will append to and/or replace the current error state until you reach a point where you can/care about handling errors, then you examine the persistent state and do something about it.
properparity
·4 yıl önce·discuss
Why would I ever care if something is a struct or not a struct? Just that is almost zero useful information.

I do care about the size of a struct sometimes, but that would require me to go to the definition of the struct, so just seeing the word "struct" didn't help me one bit.

And I of course care about the members of the struct, but that again requires me to know what the actual members are which the word "struct" doesn't give me.

So what exactly does omitting the word "struct" hide again?
properparity
·4 yıl önce·discuss
>even BIGGER no. This is completely misunderstanding what a typedef is and what it should be used for.

Hard disagree.

Life safer when dealing with things like SI unit types. I used to use lots of suffixes - _km, _m, _seconds, _hours, but I found that to be a lot more noisy (especially derived units and Nth order stuff like acceleration, seconds_per_second, etc) and evidently it would sneak in errors when you started doing calculations and passing them to functions.

Definitely want different types when I have these three representations flowing around in the program:

pressure_bits_t - raw data from the sensor, gets filtered/averaged in this form, then converted to one of these at various stages:

pressure_pascal_x10_t - integer pascal * 10 (i.e fixed point, one decimal)

pressure_millibar_t - floating point in millibar
properparity
·4 yıl önce·discuss
Mass starvation and mass migration due to climate change will most likely result in WW3.
properparity
·4 yıl önce·discuss
Also been thinking this.

What I want from a text editor is:

- Like you said, running tasks with a button/keybind, easily customizable (Like I wanna open a config file, add a function/script, bind to key/create UI button, done, not make a "plugin" not compile an "extension" or anything like that)

- Fuzzy finding/search - ripgrep and fzf can do that, so just bundle those I guess, or write my implementation of those.

- Must start instantly, load files instantly, every action needs to takes at most 100 ms.

- Be a "portable application", i.e it sits in a folder with everything it needs and I can copy that folder to any computer and be up and running with exactly the same configuration.

and NOTHING else.
properparity
·4 yıl önce·discuss
We need to let it completely loose and get everyone exposed to it everywhere so that maybe we can finally get rid of this insane taboo and uptightness about sex and nudity we have in society.
properparity
·4 yıl önce·discuss
There's several GB/s of bandwidth from disk to screen these days, so unless you're processing several GB of data you have no excuse for anything in your programs to take more than a second.

It's an insult really, such incredible waste of all the potential processing power we all have.
properparity
·4 yıl önce·discuss
Why limit yourself to crusty text when you can have live visualizations of data structures in various formats, graph dx/dy over time of some variable, stop and inspect data on some condition without having to modify code, quickly start execution on a certain line, quickly drill down into struct members, etc.

I mean it does everything a printf() can do - except just better.
properparity
·4 yıl önce·discuss
How is w=add(u, v) more explicit than w=u+v?

Because operators "should not be function calls"?

That would make zig unusable on soft float/soft div architectures, or would have to get rid of / for division and operators for floats.

But I would also assume add() is inlined and not be a function call in a sane language/compiler, so the explicitness even falls apart from the start.