Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pointer to function conversions (11.1)
#1
Hello,

rule 11.1 disallows conversions between function pointers and any other type than integral type.

1. conversion between compatible function types - are they allowed? For example:
Code:
typedef struct S1 { int x; } TS1;
struct S1 (*f1)();
TS1 (*f2)();
f1 = f2; // Is this compliant?


2. what about following case?
Code:
enum STYPE_LIST {
        TYPEA,
    };

    typedef int (*func_t)(char *);
    typedef STYPE_LIST (*func_t2)(char *);

    void moo() {
        func_t p;
        func_t2 p2;
        p= (func_t)p2;  // Is this compliant? Enum vs int
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)