Skip to content

fix: resolve static local initializer compile error in serverfps.inc - #32

Merged
Rushaway merged 2 commits into
masterfrom
Rushaway-patch-1
Aug 7, 2026
Merged

fix: resolve static local initializer compile error in serverfps.inc#32
Rushaway merged 2 commits into
masterfrom
Rushaway-patch-1

Conversation

@Rushaway

@Rushaway Rushaway commented Aug 7, 2026

Copy link
Copy Markdown
Member

Problem

GetHostTimeFrame() in serverfps.inc fails to compile:

include/serverfps.inc(36) : error 008: must be a constant expression; assumed zero
    36 |         static Address pHostTimeFrame = Address_Null;

The compiler can't resolve the named enum constant Address_Null as a compile-time constant when it's used to initialize a static local variable (unlike null, which is a compiler-level literal and works fine for static Handle elsewhere in the same file).

Fix

Remove the explicit initializer. SourcePawn static locals default-initialize to 0 on first use, which is exactly the value of Address_Null, so the logic in the function is unaffected.

`static Address pHostTimeFrame = Address_Null;` fails with
error 008 (must be a constant expression; assumed zero) because
the compiler can't fold the `Address_Null` enum constant when
used as a static local initializer.

Static locals already default-initialize to 0, which is the
same value as Address_Null, so drop the explicit initializer.
No behavior change.
Copilot AI lite review requested due to automatic review settings August 7, 2026 08:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a SourcePawn compilation error in the serverfps.inc helper include by removing an explicit static local initializer that the compiler rejects as a “constant expression,” while keeping the runtime semantics unchanged (the static still defaults to zero on first use).

Changes:

  • Remove the explicit Address_Null initializer from the static Address pHostTimeFrame local in GetHostTimeFrame() to avoid constant-expression compilation failure.

@Rushaway
Rushaway merged commit 6fbc1e6 into master Aug 7, 2026
3 checks passed
@Rushaway
Rushaway deleted the Rushaway-patch-1 branch August 7, 2026 09:51
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