Amateur Programmer Thread

If there's more off topic posts beyond this point flag them and /we/ will handle it

How did your day at work go?

This is what you do to us.


pub struct Foo<const N: usize, const P: f32>
    [(); N + 1]:,
    [(); P as usize]:,
    pub value: f32,
    pub value_expr: f32,
    pub arr_n: [u8; N + 1],
    pub arr_p: [u8; P as usize],

impl<const N: usize, const P: f32> Default for Foo<N, P>
    [(); N + 1]:,
    [(); P as usize]:,
    fn default() -> Self {
        Foo {
            value: P,
            value_expr: (f32::ln(P) as usize * 3) as f32,
            arr_n: [0u8; N + 1],
            arr_p: [0u8; P as usize],

pub fn main() {
    const P: f32 = 5.00;
    println!("Should print 5.00: {}", P as usize);
    let foo = Foo::<100, P>::default();
    println!("foo.value: {}", foo.value);
    println!("foo.value_expr: {}", foo.value_expr);

    println!("foo.arr_n {:?}", foo.arr_n);
    println!("foo.arr_p {:?}", foo.arr_p);

so this will not crash; but messing with the expression P as usize will: (say P * 3.5 as usize). I believe the answer might be somewhere here: There's currently no way to specify bounds requiring constants in types to be well-formed · Issue #68436 · rust-lang/rust · GitHub

I will leave this for fun on the weekend I think.

I don't think what I'm trying to do is possible with Rust macros.

Just wrote this:

      match (m, n, p) {
          (Some(m), Some(n), None) => ,
          (Some(m), None, Some(p)) => ,
          (None, Some(n), Some(p)) => ,
          (Some(m), Some(n), Some(p)) => todo!("Write code to handle a 3 Some(_)."),

ESR-level stuff.

Reminder to amateur programmers to not squander Unicode:

Sorry I'm on Windows 7, its fonts do not support the new unicode symbols and show them all as Blank Squares.

I'm so sorry for you.

It's not that bad. For example, this is how I see your name.
I have to copy the squares to google and see what it is on "Emojipedia".


When they stopped updating Win7 I think you could upgrade for free. You ought've done that imo



being psyopped by defense contractor recruiters who just email every single person who lives in my area

sorry dude I openly started telling my friends, family, and neighbors that I planned on renouncing my citizenship and defecting to China about 6 months ago

1 Like

Yeah China sounds like a cool place with Anime and all the Cool cars.

Purchasing an FPGA today.


Are there any electrical engineers/computer engineers on this forum, specifically someone with FPGA experience? Looking for "best-practice" stuff for designing hardware modules(?)....

Ultimately I don't really know how to phrase my question, so stackexchange isn't that helpful....

best way to start programing?


1 Like

Turns out I just wrap everything in ready/valid...

1 Like