# 1. 版本 — 已确认 18.1.8 clang-format --version # 2. 不可见字符扫描 — 用完整路径 $file = Join-Path $PWD "simdid.x86.c" $bytes = [System.IO.File]::ReadAllBytes($file) for ($i = 0; $i -lt $bytes.Length - 2; $i++) { if ($bytes[$i] -eq 0xEF -and $bytes[$i+1] -eq 0xBB -and $bytes[$i+2] -eq 0xBF) { Write-Host "BOM found at offset $i" } if ($bytes[$i] -eq 0xC2 -and $bytes[$i+1] -eq 0xA0) { Write-Host "NBSP at offset $i" } if ($bytes[$i] -eq 0xE2 -and $bytes[$i+1] -eq 0x80 -and ($bytes[$i+2] -eq 0x8B -or $bytes[$i+2] -eq 0x8C -or $bytes[$i+2] -eq 0x8D)) { Write-Host "Zero-width char at offset $i" } } Write-Host "Scan complete. File size: $($bytes.Length) bytes" # 3. 格式化对比 — 用 fc.exe 避免 PowerShell 的 Format-Custom 歧义 clang-format -assume-filename=test.c $file > formatted.c fc.exe $file formatted.c