CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact C Programming Tutorials and advice
 
Download Network Inventory 4.5 Trial Version
TRY IT FREE!!! - One Month Free Trial

eBusiness Help
Affordable Web Conferencing
Sign up for a free trial or request a free quote today
Write 10,000 lines of code in 10 minutes!
Iron Speed Designer – Free Evaluation
Enhance and Expand the Capabilities of Outlook
Take Control of Outlook With Professional Add-In Solutions

Free Software Archive:
Enterprise and Home Networking Downloads

WebProWorld Dev Forum

Does anybody recognise what ad script this is?
I'm trying to figure out if the classified ads script running http://www.myharleyswap.com is an off the shelf script I can get somewhere or if it's a custom write. I like it and I'd like to play with it a while. If nobody knows, does anybody know of one like it? It doesn't make a viewer log in to view ads, just post them, and it is searchable by several catagories. Oh yea, being able to alter what it costs to post would be nice too. Thanks.

Article Script
Does anyone know of a good article script? This script must allow me the ability to accept or decline articles, edit articles, RSS feed and ability to custormize to full potential. Thanks

I need a php show html link script please
I want to be able to only display a link if a certain value is present in my database. I've made the option 1 or 2. I only want the link to appear if the option is equal to 1. Any ideas on how I could do this? I probably need to give more info than this! ..



Recent Articles

C++ or C (or both?)
Some of you may have made use of Dean Jones' CleanCode Email. It's a nicely done mail sender - it's not an SMTP server, it just sends mail, but lets you...

A Bit of C Debugging
I have a customer who has a hodge-podge of machines running various software programs.

HLA - The High Level Assembly Programming Language
I've noted before that assembly language programming can be quite engrossing. It's the level of detail that captivates; there can be a great deal of craftmanship...

Creating a Windows Explorer Clone
Any developer who has ever wanted to provide file/folder browsing or file-selection functionality in his own application knows the utter lack of simple, extensible and customizable MFC components for this purpose.

01.12.06


C Pointer Problems


By A.P. Lawrence

This was written in January of 1990, but is still meaningful today, though we do have better debugging tools now. This was originally published in the Boston Computer Society's PC Report.

I admit it: I'm sometimes just not careful where I'm pointing. In ordinary life, careless pointing might be rude, but in C programming, it tends to be unforgivable.

Right now, for example, I'm chasing an errant pointer that cannot be found using Codeview (Microsoft's debugger). That is, if run under Codeview, the program works correctly, but crashes when run without it. This might sound like a real hair-tearer, but usually this kind of problem isn't too hard to find. Usually, that is.

If a program works under a debugger but crashes otherwise, the problem is almost always an uninitialized pointer. The reason it works during debugging is because the debugger either provides initialization or happens to arrange memory so that your error doesn't hurt anything important. Every time this happens, it turns out that I've screwed up. Every time. All I have to do is find where I made the mistake.

This particular pointer is hiding very well. So well that it actually is hard to crash it on my machine: I have to feed it garbage data to see the problem. On my client's hardware, it pops up without provocation, and destroys screens, rampaging through data in memory, changing this and discarding that, and ultimately exits with the dreaded "Null Pointer Assignment" message. Sometimes. Other times, the program just clicks along, doing its thing. Frustratingly random, so very hard to find.

It is tempting (so very tempting) to blame this on hardware. We are talking about an off-brand machine, and a 386SX at that. "Works OK here", wash my hands and walk away. Trouble is, everything else in the world works fine on that box. Every diagnostic gives this machine a totally clean bill of health. And there is that nagging reality that, albeit with difficulty, I can cause the problem on my own machine. The error may be esoteric, but it is real.

My first approach is calm and logical. I wrote the code, I understand its intent, I am a supposedly intelligent person - I can find this by carefully reading the source.

That lunacy lasts about ten minutes. There is no way I'm going to read 107K of source code. In fact, I'm banging away at the keyboard before I'm two screens into the first source file. Banging what? Why "printf"'s, of course. Dozens of "The address of Dir_now is %p and the contents are %sn" thing-a-mungies are now cluttering the code. Remember Codeview is no help because it works under Codeview. And DEBUG is no help because DEBUG is no help.

Days later I was back to the scientific approach. The printf's hadn't helped, and I was getting slap happy. I had visions of Kernighan and Ritchie using excepts of my code for a new book: "Making an unbelievable mess with C, a Case Study". I started adding sarcastic comments to my code:

/* Real smart using floats for "for next loops" */
..
/* Gee, do any of these variable names MEAN anything? */


I also started adding apologies:

/* Added this at 2:00 AM - need to fix */
..
/* Really rushed here - I can fix this later */
..
/* There's a reason for this mess here - honest */


Bald faced lies, of course, added only in case I had to enlist someone else to help me find this thing.

The Zen approach seemed worth a try. You know, you just inform your subconscious that this problem is serious, and then you go off and do something else. Within a few days, the solution will magically appear, perhaps in a dream. My subconcious had to be aware of how distressed I was - would I absent mindedly pop a handful of our pet gerbil's food pellets in my mouth were I not stressed? So I decided to do something else for a day or two. No luck: my subconscious has apparently moved to Cincinatti; I haven't heard anything from it in weeks.

Yesterday I gave a copy of my code to a friend in hopes he can spot the problem. I'm getting desperate here..

My friend called, opening with caustic comments about aesthetics and user friendliness, peppered with snide observations on sloppy coding. "But does it crash on your box?", I asked. "No, it doesn't, unless I feed it your 'bad' data. You have an uninitialized pointer." Hopefully I asked, "Do you know where?". He laughed. "You know what you have to do, right?"

Yes, unfortunately I do. Back to the "printf"'s.

*Previously published at APLawrence.com

About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com




-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2006 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


CProgrammingTrends News Archives About Us Feedback