Home   |   Technology   |   About us   |   Developers   |   FAQs   |   Contact
   The Challenge


   G-WAN's Forum

   Timeline
   

"Whether you believe you can do a thing or not, you are right."
(Henry Ford)

Better tools let you build better solutions

Why use C rather than a 'modern' language for G-WAN scripts?

   1.  If you know C, how many other languages do you need to learn*?
   2.  ANSI C is stable, efficient and available on all hardware platforms.
   3.  C can be as safe as any other language (see the 'crash.c' servlet).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "gwan.h" // G-WAN exported functions

int main(int argc, char *argv[]) 
{
   xbuf_ctx reply;          // create a dynamic buffer
   get_reply(argv, &reply); // setup the server reply

   char *name=0;            // get an URL parameter
   get_arg("name=", &name, argc, argv);

   xbuf_xcat(&reply, "Hello %s", // format a safe reply
             escape_html(name, name, 20)?name:"you");

   set_reply(argv, &reply); // update the server reply
   return(200);             // HTTP status (200:'OK')
}

The best way to understand G-WAN's capabilities is to play with it: just click on the links below (press the browser's 'back' button to return to this page):

servlet descriptionrunsrc
  'Hello World' sample (used to benchmark servlets)[run][src]
  Calculate an HTTP time string (G-WAN vs. Windows)[run][src]
  (GET or POST) AJAX form to calculate loan payments[run][src]
  (GET or POST) contact form to get email from users[run][src]
  Query the ECB to get 34 currency exchange rates[run][src]
  Attack G-WAN with hundreds of malicious URIs (be creative)[run][src]
  Make G-WAN crash (it won't) and get an useful crash report[run][src]

[*] C is a 40-year-old free standard that offers more source code than all 'modern' alternatives... which have all been written in C (probably for a reason).



Copyright © 2007-2010 TrustLeap, All Rights Reserved   |   Legal Notices