Skip to content

Conversation

@fox0
Copy link
Contributor

@fox0 fox0 commented Sep 28, 2024

No description provided.

@jgarzik
Copy link
Contributor

jgarzik commented Sep 28, 2024

This appears to be a regression: Changing a simple compile-time constant to reading a runtime environment variable into a program variable. This is less optimal and more compiled output for no apparent value?

@fox0
Copy link
Contributor Author

fox0 commented Sep 28, 2024

It is compile time: https://doc.rust-lang.org/std/macro.env.html

@fox0
Copy link
Contributor Author

fox0 commented Sep 28, 2024

$ cargo expand --bin sleep main
   Compiling proc-macro2 v1.0.86
   Compiling libc v0.2.159
   Compiling num-traits v0.2.19
   Compiling quote v1.0.37
    Checking chrono v0.4.38
   Compiling syn v2.0.79
   Compiling clap_derive v4.5.18
    Checking clap v4.5.18
    Checking posixutils-datetime v0.2.1 (/home/fox/just_for_fun/posixutils-rs/datetime)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.36s

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let args = Args::parse();
    setlocale(LocaleCategory::LcAll, "");
    textdomain("posixutils-rs")?;
    bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
    unsafe {
        signal(SIGALRM, SIG_IGN);
    }
    thread::sleep(time::Duration::from_secs(args.seconds));
    Ok(())
}

@jgarzik
Copy link
Contributor

jgarzik commented Sep 30, 2024

maybe later. too big, for the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants