Intermediate Rust
Q79 / 100

What is Rust's cfg! macro and #[cfg] attribute?

Correct! Well done.

Incorrect.

The correct answer is B) Compile-time conditional compilation based on platform, features, or custom flags

B

Correct Answer

Compile-time conditional compilation based on platform, features, or custom flags

Explanation

#[cfg(target_os = "linux")] fn platform_func() compiles only on Linux. cfg!(debug_assertions) is a bool constant. Used for platform-specific code and feature gates.

Progress
79/100