[FIXED] Expression list treated as compound exression in functional cast cast [-fpermissive] ?

  • Hello, I have a simple daemon with init method which has the following declaration:
    @void init_daemon(smain, int, char**)@
    where smain is the following callback to original main function
    @typedef int (smain)(int, char*)@
    I am using the function as follows:
    @void init_daemon(smain s, int argc, char* args[]) {
    int i, lfp;
    char str[10];
    if ( getppid() == 1) {
    /already a daemon/
    i = fork();
    if ( i < 0 ) exit(1); /* fork error */
    if ( i > 0) exit(0) ; /*parent exit */

    for (i= getdtablesize(); i >=0; --i) close(i) ; //close all descriptors
    i = open("/dev/null", O_RDWR); dup(i); dup(i); /* handle standard I/O ??? read further */
    lfp=open(LOG_FILE, O_RDWR | O_CREAT, 0640);
    if ( lfp <0) exit(1);
    if ( lockf(lfp, F_TLOCK, 0) < 0) exit(0);
    sprintf(str, "%d\n", getpid());
    write(lfp, str, strlen(str));
    signal(SIGCHLD, SIG_IGN);
    signal(SIGTSTP, SIG_IGN);
    signal(SIGTTOU, SIG_IGN);
    signal(SIGTTIN, SIG_IGN);
    signal(SIGHUP, signal_handler);
    signal(SIGTERM, signal_handler);
    smain(argc, args); // --------- > s(argc, args);

    It gives me the error in smain(argc, args) call. The main.c file is as follows:
    @#include <QApplication>
    #include <iostream>
    #include "Daemon.h"
    #include "DirectoryDeleter.h"

    int selfMain(int, char*[]);

    int main(int argc, char *argv[])
    init_daemon(selfMain, argc, argv);

    int selfMain(int argc, char** argv) {

    QApplication a(argc, argv);
    QString* s = new QString(argv[1]);
    std::cout << s->toStdString() << std::endl;

    // DirectoryDeleter* dr = new DirectoryDeleter(s, &a);
    dr = DirectoryDeleter::getSingleInstance();
    DirectoryDeleter::getInstance()->setFileName("DAEMON TESTING")
    return a.exec();

    Can you explain why is this error?

    Sorry I`ve noticed it ... Dull too much code

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.