Valid octal C23 prefixes 0o and 0O report error 19

Offen
#14,872 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
65/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
cpp, typescript
Bereich
devtools

Rechercherichtung

Start by reproducing the report in VS Code with the supplied octal.c example, then trace how the C/C++ extension diagnoses numeric literals in C23 mode. Check that 0o640 and 0O640 no longer produce error 19 while the existing 0640 case still works; the issue names no source files or tests, so locate the relevant parser or diagnostic tests first.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Environment
  • OS and Version: Linux 7.2.14-arch1-1
  • VS Code Version: 1.145.2
  • C/C++ Extension Version: v1.35.6
Bug Summary and Steps to Reproduce

Bug Summary:
The number octal prefixes 0o and 0O wrongly report an error in the editor, even appearing in the 'Problems' tab. Even though this is supported since C23 and it compiles fine.
The error is: extra text after expected end of number C/C++(19)

To reproduce, create an octal.c file in vscode and paste:

#include <stdio.h>

int main(){
	int octal_number0 = 0640; // old school (deprecated in C2y/C29 draft) octal prefix works fine
	int octal_number1 = 0o640; // error 19 reported
	int octal_number2 = 0O640;

	printf("%#x\n", octal_number0); // prints "0x1a0"
	printf("%#x\n", octal_number1); // prints "0x1a0"
	printf("%#x\n", octal_number2); // prints "0x1a0"

	return 0;
}

Compiling with clang -g -Wall -Wextra -std=c23 octal.c -o octal && ./octal works without any error or warning
If you compile with -std=c2y instead, you get a deprecation warning for the 0 prefix, but the other two are still fine

Configuration and Logs
None
Other Extensions

No response

Additional context

No response

Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
12

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/vscode-cpptools

Alle Issues in microsoft/vscode-cpptools

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.