Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Enum.7 Reason text is misleading

Aperta
#2,079 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
48/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
documentation

Direzione di ricerca

Cerca nel repository Enum.7 e il testo Reason citato, quindi leggi la linea guida collegata e la motivazione che la circonda. Aggiorna la formulazione della linea guida per evitare di implicare che int sia sempre il valore predefinito e verifica che la documentazione renderizzata mantenga la spiegazione prevista.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The current "Reason" for Enum.7 is currently

**Reason** The default is the easiest to read and write. int is the default integer type. int is compatible with C enums.

This feels misleading, as a quick and natural reading of it strongly implies that the default type for an enum is int, when it is not. Both clang and gcc default to unsigned int on linux, while MSVC defaults to int on x64 for enums with smallish values (see https://godbolt.org/z/fPWczEon3).

The default type is also going to change based on the actual values in the enum.

I don't believe that the more complex language in the standard about "the underlying type is an integral type that can represent all the enumerator values defined in the enumeration" is useful in this guideline, however maybe you could just say something like the following (just leave int out of the reason)?

**Reason** The default is the easiest to read and write and is compatible with C enums.

Or maybe rework this guideline entirely in the face of the potentially-confusing underlying behavior?

[edit: some grammar]

Lingua principale
CSS
Stelle
45.3k
Fork
5.6k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di isocpp/CppCoreGuidelines

Tutte le issue di isocpp/CppCoreGuidelines

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.