devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

How to define an object-internal constant?

When you need a constant integer member in an object, the easiest way to create one is by using a nameless enum, which can be used like any const int:

Passing unmodifiable arguments as constobjects

Passing large objects by value as function arguments is very inefficient. On the other hand, passing them by reference/address is dangerous since it enables the callee to change its arguments

Prefer References Over Pointers

Even experienced C++ programmers who have prior experience with C tend to use pointers excessively whereas references may be a better choice. Pointers may result in bugs like the following:

Copy constructor and operator= go together

If you do not define a copy constructor and operator = , the compiler will create them automatically for you. However, there are cases when you have to define them

Better alternative to #define constants

Using #define to create macro constants is not ideal. Macros are substituted by the preprocessor, so the compiler usually cannot detect anomalies such as type mismatch (see example); furthermore, most

Explicit destructor invocation

One of the good things about destructors is that they are called automatically. There are rare cases, however, when you want to invoke an object

Make the Right Comparison

Although Java’s String package is a lot more friendly than C’s string handling, you can still find yourself surprised by its behavior at times. Consider this code: import java.lang.String;public class

What are we Looking at?

To present your applet in a visually pleasing way, it’s often handy to know the size of the screen that’s available for output. Fortunately, a built-in AWT function makes determining

A const member function

Whenever you define a class member function which does not (and should not) change its object, it’s a good idea to define it as a const member function. There are

Activate Your Applets

Did you ever feel the urge to use a nice Java class you just wrote as an ActiveX object on your Windows machine? Good news: you can do it in

Linked List vs. File I/O

Question: Can you explain to me how a linked list works with FILE I/O. For example, how do you add, modify, delete, and search for a student record in a

CL.EXE Error

Question: I installed MS Visual C++ 5.0 at work and on my home machine. At work it’s fine running on Windows NT with 96 megs of RAM. On my home

Variable-length data in structs

Question: Can I have variable length fields in a structure. I have tried something like: typedef struct { int length; char data[length];}; but that won’t compile. Is there a way,

Autolaunch library PB configuration

Question: When I open PowerBuilder, I want it to open showing the library painter by default. I tried modifying the Target in the Propeties for the PowerBuilder icon by adding

Viewing Text File

Question: How can I view and print a text file in PB5-16? I don’t need to edit. Answer: Use the FileOpen, FileRead and FileClose commands to read you text file.

PowerBuilder dynamic menus

Question: We want to create menus dynamically where we store the menu items in a table. While running the application, we want to read the values from the table and

Virtual Functions and Polymorphism

Question: Say you have three classes, a base (called Base),and two classes derived from it (called Derv1 andDerv2). Base has a pure virtual function (called TypeGet()) that is defined in

List of keys in a .ini section

Question: Is there a Windows function or some quick wayget a list of the keys in an .ini file, such as: [Section]Key1=xxxKey2=yyyKey3=mmmKey4=ppp I want this: ‘Key1’, ‘Key2’, ‘Key3’, ‘Key4’ Answer:

Out of Memory errors in Delphi 2.0

Question: I am working on my first Delphi 2.0 application which has grown to be quite large over the past few months. The problem is that lately I have been

Mouse Support Under DOS

Question: In what direction should I look to find a way tobuild a simple dos aplication with mouse control. Answer: Building a DOS application that provides mouse support involves writing

Endless Loop

Question: I am having a problem with getting an infinite loop out of a particular program and I am not quite sure where the problem is at. If you could

DOS Graphics vs. Windows

Question: Is there a header file in Visual C++ v4 (sorry a bit behind :)) that replaces the old graph.h? I am writing console apps for school and would like

Accessing I/O Memory under Win32

Question: I would like to program the parallel port in Windows NT or 95. What should I do? Answer: At the simplest level, accessing the parallel port involves reading and

How to Learn C++

Question: What is the best way to learn c++?I can study on line, by book or attend a course.Which are the bests places to start. Answer: The answer really depends

Aborting a Loop

Question: Is there any way to abort a loop with just pressing a kee. Like you could do in Pascal: dountil keypress Answer: If you are writing a loop that

Wild card searching using DataWindow

Question: I tried to place wild-card (e.g. ‘%Ken%’) for the searching of records in a DataWindow through QueryMode, but couldn’t get the result. Are there any other ways to do

External function for checking a process

Question: Our Powerbuilder application launches an external program using the RUN command. We use the Timer Event to keep checkingif the process is running by using theKERNAL32 external function GetModuleHandleA.

Compressed file types

Question: I recently downloaded some applet source code, but they are all stored in “.tar” type files. What program do I need to expand them or otherwise make them useful?

Time formatting

Question: I need to find 2 things. I need a classthat will allow me to take a date and addand subtract days/months/years from it. I also need a class that