Web development in C: Crazy?
31–40 of 213 posts
Re: Web development in C: Crazy?
#32 // Open the storage subsystem.
void open_storage()
{
EXEC SQL BEGIN DECLARE SECTION;
const char* database = DATABASE_NAME;
const char* username = USERNAME;
const char* schema = SCHEMA;
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER SQLERROR CALL quit();
EXEC SQL CONNECT TO :database USER :username;
EXEC SQL SET search_path to :schema;
}
ECPG: http://www.postgresql.org/docs/current/interactive/ecpg.htmlMy takeaway was that it was a lot easier than I expected, but it was still kind of a minefield. ECPG isn't widely used or highly intelligent, so there are a lot of stumbling blocks despite the pretty high quality documentation. I would recommend hiding your ECPG behind some functions so you only have to run some of your files through the pre-processor. But it is a neat tool and I could see myself using it again.
Re: Web development in C: Crazy?
#33So, people can't hardly write safe web apps in PHP without spraying XSS and auth bypasses and arbitrary shell executions and arbitrary SQL injections everywhere, and you also want to hand the attackers the ability to segfault your server or possibly even straight-up run arbitrary code? Anyone smart enough to truly safely code a website in C is smart enough to learn a language to create that website which doesn't get…
That said, doing web development in a language with neither a REPL nor built-in unicode support sounds like a Bad Time.
Re: Web development in C: Crazy?
#34Re: Web development in C: Crazy?
#35So, people can't hardly write safe web apps in PHP without spraying XSS and auth bypasses and arbitrary shell executions and arbitrary SQL injections everywhere, and you also want to hand the attackers the ability to segfault your server or possibly even straight-up run arbitrary code? Anyone smart enough to truly safely code a website in C is smart enough to learn a language to create that website which doesn't get…
Re: Web development in C: Crazy?
#36I once wrote a toy web page in C; Lex made for nice HTML templating and with pseudOO it actually felt pretty modern, but I still wasted a whole lot of time reinventing various wheels.
Re: Web development in C: Crazy?
#37WHYYYYYYYYY No, seriously, why ? As far as I can tell, his entire argument is "web development in C is terrible and limiting, but not as quite as terrible and limiting as you might think." I guess that's good news if terrorists are forcing you to write websites in C, but I don't see even an attempt at explaining why you would choose to do this.
Re: Web development in C: Crazy?
#38There were two things I did that actually made it pretty painless to work with: I implemented a Dreamweaver template processor that you could hook up to output a string or execute a block on each template element. I also implemented a preprocessor that allowed injection of large HTML blocks:
for (int i = 0; i (((i))). {{{strings[i]}}}]]]
}
It's an interesting exercise, but as soon as I left they scrapped it for something maintainable.Re: Web development in C: Crazy?
#39WHYYYYYYYYY No, seriously, why ? As far as I can tell, his entire argument is "web development in C is terrible and limiting, but not as quite as terrible and limiting as you might think." I guess that's good news if terrorists are forcing you to write websites in C, but I don't see even an attempt at explaining why you would choose to do this.
Maybe your problem is CPU-bound. Maybe there are good C libraries that solve your problem. Maybe you just want to learn C better. Maybe you have latency limits you need to work within. Maybe you just want to be contrary. Sometimes "why not" is worth more than "why."
Re: Web development in C: Crazy?
#40At my first web job circa 1996, our shopping cart product was mostly C, so I did web development in C for about two years. I'm not sure that using C was the craziest thing about how we did things. Nobody really had an idea how to structure a web app, so it was more or less a dozen or so CGIs which read/wrote to flat files through custom-written dbm clone (woo, NoSQL in '96!). Lots of unsophisticated string munging. M…