typedef struct FileHdr
{
unsigned long reg;
unsigned short width;
float sfactor;
struct FileHdr huge *next;
}FileHdr;
FileHdr huge *Hdrhead=NULL,h uge *Hdrcur=NULL;
//
//
Hdrhead=(FileHd r huge *)malloc(sizeof (FileHdr));
//some operation
free(Hdrhead);
when i try to free huge pointer i get a warning stating suspicious pointer conversion
is there any other best way to free huge pointer
5 1681
The name of your struct and the typedef are the same.
The name of your struct and the typedef are the same.
I hope that is allowed, i can do all the operation that i want to, but i am not finding way to release used memory (huge pointer).
In:
struct FileHdr huge *next;
What does "next" point to? As far as I can tell, struct FileHdr is the type specifier, so what is "huge"? Also, watch out when you delete the pointer to FileHdr as it looks like you could loose the pointer to the next FileHdr (Hdrhead->next) so its memory can never be freed.
Banfa 9,065
Recognized Expert Moderator Expert
The problem is that you are passing a huge pointer to free
For those that don't know some platforms allow specifying pointer semantics relevant to the memory model in use. the huge indicates the type of pointer and where it can point. huge was memory model available in 16 bit Windows (WIN16, Windows 3.1x and earlier).
That is the suspicious conversion, an implicit cast away of the huge pointer semantics.
You don't get an error on cast void * to void huge *, when mallocing, because that is a valid conversion, any void * can be represented by a void huge * but not any void huge * can be represented by a void * hence the error when calling free.
Because malloc returns void * use of the huge pointer semantics is pointless you could just as well remove all those voids and the code should still work (and be more portable).
What platform are you using?
For those that don't know some platforms allow specifying pointer semantics relevant to the memory model in use. the huge indicates the type of pointer and where it can point. huge was memory model available in 16 bit Windows (WIN16, Windows 3.1x and earlier).
Interesting, that's why I didn't find it in my Stroustrup...
PS: I see now that near, far and huge pointers date back to the pre-i386 days.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: abcd |
last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual
vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a
ljetvedehg, hard slog," mariyu vede legai pressed Pentagjetvedeh
karuvificials madhla reachathe strategy in karkun campaign deshatinst
terrorism.
"mudivae maretu winning or losing karkun global varti jetvedeh terror?" Mr.
Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
|
by: J. Nielsen |
last post by:
I'm not a programmer and I don't have the time and energy to start learning
right now So I need some help.
Let's say I have made an HTML Table (consisting of three columns and six
rows). In each cell, in the first column I have put in an image (six
different ones).
In the second column I have merged all six cells into one cell and there put
in an image matching the background colour.
In the right column I have again put in six different...
|
by: na1paj |
last post by:
here's a simple linked list program. the DeleteNode function is
producing an infinit loop i think, but i can't figure out where..
#include <stdio.h>
typedef struct
{
char *str; //str is a dynamic array of characters
int length; //number of characters
} String;
|
by: David Ford |
last post by:
I have a macro that I use across the board for freeing ram. I'd like to
clean up my code so I don't get these warnings.
#define sfree(x) _internal_sfree((void **)&x)
#define _internal_sfree(x) ({ if(x && *x) { free(*x); *x=NULL; } })
void somefunction() {
char *x = malloc(10);
int *y = malloc(10);
|
by: skumar434 |
last post by:
Hi everybody,
I am faceing problem with strings.
The code is given bellow .In this program i am tring to copy data from
a file into structure .
I am able to copy the data ,but the dat is needed to run some commands
,as u can see i have a string which has the command.
The command is---- chicmd debug 0xB701 0x000000ce3 0xAABBCCDD
| |
by: Raman |
last post by:
Hi All,
Here is a small Code,
int main(void)
{
char *p=(char *) malloc(100);
strcpy(p,"Test1234567890");
p=p+10;
free(p);
|
by: weidongtom |
last post by:
Hi,
I tried to implement the Universal Machine as described in
http://www.boundvariable.org/task.shtml, and I managed to get one
implemented (After looking at what other's have done.) But when I use
to run a UM program, I kept on getting error messages. I have used
someone else's implementation and it runs fine. I have compared my
code with other's and I still can't figure it out what's wrong with
mine. So please help me out, after 3...
|
by: Chris AtLee |
last post by:
Sorry for the repeat post...I'm not sure if my first post (on May
30th) went through or
not.
I've been trying to write a PAM module using ctypes. In the
conversation
function (my_conv in the script below), you're passed in a
pam_response**
pointer. You're supposed to allocate an array of pam_response's and
set
|
by: Alf P. Steinbach |
last post by:
I once suggested in that SomeOne Else(TM) should propose
a string value class that accepted literals and char pointers and so on,
with possible custom deleter, and in case of literal strings just
carrying the original pointer.
In other words, for the simplest usage code:
* no overhead (just carrying a pointer or two), and
* no possibility of exceptions (for that case).
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |