Member-only story
ChatGPT failed to do three things every programmer knows how to do
ChatGPT is one of the most popular artificial intelligence tools used today. ChatGPT has made headlines around the world as the future of technology , and being claimed to do things no human is capable of. It’s even been touted as the replacement to many jobs humans perform today.
However, as a software engineer, I decided to put ChatGPT to the test. What I would consider a real test. Writing a web server in the C programming language. This requires thinking about multiple components of a program, like signal handling, sockets, memory, and more. However, when I asked ChatGPT to do this,
It failed.
Not only did it fail, it did mistakes so obvious and serious, no programmer would make these mistakes. Compiling and running such code that ChatGPT wrote in my trial case would crash or cause a memory leak.
The Conversation
To start off with, I asked it the following:
write a webserver in C
It replied:
Writing a web server in C is a complex task, but here is a basic example of how you can create a simple web server using sockets in C:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include…