Ho notato un comportamento molto curioso che, se standard, sarei molto felice di sfruttare (quello che mi piacerebbe fare con esso è abbastanza complesso da spiegare e irrilevante alla domanda).Dichiarare una funzione statica e successiva non statica: è standard?
Il comportamento è:
static void name();
void name() {
/* This function is now static, even if in the declaration
* there is no static keyword. Tested on GCC and VS. */
}
Cosa c'è di curioso è che l'inverso produce un errore di compilazione:
void name();
static void name() {
/* Illegal */
}
Quindi, è questo standard e può mi aspetto altri compilatori a comportarsi nello stesso modo ? Grazie!
Sto usando C++, ma ho aggiunto un tag C perché ho pensato che sarebbe stato lo stesso in C. –
oh e grazie per l'ottima risposta –