POV-Ray : Newsgroups : povray.off-topic : Job Interview : Job Interview Server Time
29 Jul 2024 06:24:58 EDT (-0400)
  Job Interview  
From: John VanSickle
Date: 4 Mar 2012 16:20:38
Message: <4f53dca6$1@news.povray.org>
Thursday I interviewed with a company in the Houston, Texas area.

One of the interviewers had me examine two pieces of buggy code and try 
to identify the bugs.  I don't remember all of the details.  Here is the 
first one:

function() {
// some stuff

	if (whatever) {
		// code here to get a mutex lock
		// other stuff
	}
	// code here to release the mutex lock
	// the rest of the function code
}

The way I simplified it makes it easier to spot the bug.

The second one was issued with the warning that very few people can id 
the bug:

char* some_function() {
	char yada[100];

	char* p=yada;

	// some stuff that fills the array with data

	// and more stuff

	// and more stuff

	return p;
}

When I saw the return statement, and looked back to what the pointer was 
set to, I said, "I wouldn't do that."
"Do what?" the interviewer asked.
"Return a pointer to a local variable."
This provoked a laugh from the interviewer.

Seriously?  Not many people catch that?

Evidently not.  In chatting with the interviewers that day, they all 
confirmed that most bugs are stupid things like this.

Anyway, the job prospect is still a going affair, so I suppose I did 
okay in the interview.

Regards,
John


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.