
Godzil (./3830) :
Ho les piles faites pour l'aeromodelisme... des bombes sous hélices
Folco (./3839) :
J'ignorais, en tout cas j'ai jamais vu. Et en compet, c'est chaque élément d'un accu qui est controlé indépendamment pendant la charge
palouf -> tu donnes dans le modélisme toi aussi ?
Par exemple, void truc() { } int main(int argc, char *argv[]) { truc(42, "toto");ne génère pas de warning.
struct machin; typedef void (*callback) (); typedef struct { int a; callback cb; } machin; ... void cb (struct machin* chose) { ... }
squalyl (./3849) :
oh je veux le source qui produit cette erreur
(sapu le c++)
#ifndef BUTTON_H
#define BUTTON_H
#include <stdbool.h>
#include <SDL2/SDL.h>
#include "ContextHelp.h"
#define BUTTON_ENABLED true
#define BUTTON_DISABLED false
struct BUTTON;
typedef bool (*button_MouseIn)(struct BUTTON* button);
typedef bool (*button_MouseOut)(struct BUTTON* button);
typedef bool (*button_LeftClick)(struct BUTTON* button);
typedef struct
{
SDL_Texture* SprEnabled; // Cannot be NULL
SDL_Texture* SprDisabled; // May be NULL
SDL_Texture* SprClicked; // May be NULL
//
button_MouseIn in; // May be NULL
button_MouseOut out; // May be NULL
button_LeftClick leftclick; // Cannot be NULL. Will be triggered on clic
//
bool enabled; // Button is not affected by the mouse if enabled is false
/*
* Internal
*/
int mouse_status; // Status of the mouse over the button
SDL_Rect dest; // Destination location and size of the button
SDL_Texture* sprite; // The sprite currently used
CONTEXT_HELP* context; // Current help context
SDL_Texture* help; // The texture given to the context help handler
} BUTTON;
#define STATUS_MOUSE_OUT 0
#define STATUS_MOUSE_IN 1
#define STATUS_CLICK_LEFT_DOWN 2
#define STATUS_CLICK_LEFT_UP 3
bool ButtonInit (struct BUTTON* button,
char* SprEnabled,
char* SprDisabled,
char* SprClicked,
int x,
int y,
bool enabled,
button_MouseIn in,
button_MouseOut out,
button_LeftClick leftclick,
char* help,
CONTEXT_HELP* context);
void ButtonClose (struct BUTTON* button);
bool ButtonUpdate (BUTTON* button, SDL_Event* event, int mouse_x, int mouse_y);
bool ButtonDraw (struct BUTTON* button);
#endif // BUTTON_H
#ifndef BUTTON_H
#define BUTTON_H
#include <stdbool.h>
#include <SDL2/SDL.h>
#include "ContextHelp.h"
#define BUTTON_ENABLED true
#define BUTTON_DISABLED false
struct BUTTON;
typedef bool (*button_MouseIn)(struct BUTTON* button);
typedef bool (*button_MouseOut)(struct BUTTON* button);
typedef bool (*button_LeftClick)(struct BUTTON* button);
typedef struct
{
SDL_Texture* SprEnabled; // Cannot be NULL
SDL_Texture* SprDisabled; // May be NULL
SDL_Texture* SprClicked; // May be NULL
//
button_MouseIn in; // May be NULL
button_MouseOut out; // May be NULL
button_LeftClick leftclick; // Cannot be NULL. Will be triggered on clic
//
bool enabled; // Button is not affected by the mouse if enabled is false
/*
* Internal
*/
int mouse_status; // Status of the mouse over the button
SDL_Rect dest; // Destination location and size of the button
SDL_Texture* sprite; // The sprite currently used
CONTEXT_HELP* context; // Current help context
SDL_Texture* help; // The texture given to the context help handler
} BUTTON;
#define STATUS_MOUSE_OUT 0
#define STATUS_MOUSE_IN 1
#define STATUS_CLICK_LEFT_DOWN 2
#define STATUS_CLICK_LEFT_UP 3
bool ButtonInit (BUTTON* button,
char* SprEnabled,
char* SprDisabled,
char* SprClicked,
int x,
int y,
bool enabled,
button_MouseIn in,
button_MouseOut out,
button_LeftClick leftclick,
char* help,
CONTEXT_HELP* context);
void ButtonClose (BUTTON* button);
bool ButtonUpdate (BUTTON* button, SDL_Event* event, int mouse_x, int mouse_y);
bool ButtonDraw (BUTTON* button);
#endif // BUTTON_H
struct struct_t;
typedef void (*callback_t) (struct struct_t* arg);
typedef struct
{
callback_t cb;
} struct_t;
void cb (struct_t* arg)
{
(void) arg;
}
int main (void)
{
struct_t s;
s.cb (&s);
return 0;
}
$ gcc -W -Wall test.c -o test test.c: In function ‘main’: test.c:20:9: warning: passing argument 1 of ‘s.cb’ from incompatible pointer type s.cb (&s); ^ test.c:20:9: note: expected ‘struct struct_t *’ but argument is of type ‘struct struct_t *’
grx@grxmint ~ $ gcc wut.c wut.c: In function ‘main’: wut.c:18:3: warning: passing argument 1 of ‘s.cb’ from incompatible pointer type [enabled by default] s.cb (&s); ^ wut.c:18:3: note: expected ‘struct struct_t *’ but argument is of type ‘struct struct_t *’ah oui
struct struct_t; // ici tu definis le type A typedef void (*callback_t) (struct struct_t* arg); //ici tu utilises le type A typedef struct struct_t { callback_t cb; } struct_t; // ici tu definis un type B void cb (struct_t* arg) //ici tu utilises le type B { (void) arg; } int main (void) { struct_t s; // type B s.cb (&s); // mais le cb attend un type A donc PAN return 0; }
grx@grxmint ~ $ clang wut.c wut.c:18:9: warning: incompatible pointer types passing 'struct_t *' to parameter of type 'struct struct_t *' [-Wincompatible-pointer-types] s.cb (&s); ^~ 1 warning generated.
Nhut (./3866) :
Dans l'absolu j'aurais voulu un AZEERTY belge, mais tant pis je me contenterai d'un clavier FR
Folco (./3867) :
c'est où les planches de qualité qui ne vont pas me ruiner stp ?