|
by: DanielBradley |
last post by:
Hello all,
I have recently been porting code from Linux to cygwin and came across
a problem with static const class members (discussed below). I am
seeking to determine whether I am programming non-standard C++ or if the
problem lies elsewhere.
To summarize static const class members are not being accessed properly
when accessed from a...
|
by: Steven T. Hatton |
last post by:
Any opinions or comments on the following? I don't say it below, but I came
out on the side of using enumerations over static constants.
/* I'm trying to figure out the pros and cons of using static const
* int class members as opposed to using enumerations to accomplish a
* similar goal. The use of static constants seems more explicit and...
|
by: Steven T. Hatton |
last post by:
Sorry about the big code dump. I tried to get it down to the minimum
required to demonstrate the problem. Although this is all done with GNU, I
believe the problem I'm having may be more general. Someone on the SuSE
programming mailing list suggested my problem is that I'm trying to execute
a function (I assume he meant the constructor) at...
|
by: cppsks |
last post by:
"Defining static const variables inside the class is not universally
supported yet, so for now I guess you'll
have to move the definition out of the body of the class.
No, static const inside classes is only allowed for integral consts, like
static const enum and static const int, not for arrays and structs. It does
make sense for an array...
|
by: Dave |
last post by:
const static int ARRAY_SIZE = 4;
Comeau online gives this warning:
"ComeauTest.c", line 10: warning: storage class is not first const static
int ARRAY_SIZE = 4;
Why is static const preferable to const static?
|
|
by: Sek |
last post by:
hi folks,
i have a bunch of strings used in my code in many places.
these strings reside inside a instantiable class.
so, i want to replace these with constant/static variable to control
the occurences.
i have been looking at both static and const variables as the options,
but couldn't decide on one.
|
by: Adrian |
last post by:
Hi,
In a header file I tried const char *someval="this is a test"; which
is included all over the place and I get linker errors about multiple
defines.
Why is this not folded when const char someval="this is a test"; is
and I get no linker errors?
|
by: John Goche |
last post by:
Hello,
I would like to know whethere there is a difference between
a const variable and a static const variable inside a class.
After all, if a variable is const in a class, the compiler can
always optimize and turn it into a static const variable to
save runtim memory/stack space since being const it
cannot be changed. (?)
Thanks,
|
by: Spoon |
last post by:
Hello everyone,
I have a Packet class I use to send packets over the Internet. All the
packets sent in a session are supposed to share a common random ID.
I figured I'd use a static const member inside my class.
class Packet
{
static const int session_id;
|
by: wizofaus |
last post by:
Given the following code:
public class Test
{
static unsafe void StringManip(string data)
{
fixed (char* ps = data)
ps = '$';
}
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|