Hello everyone. I was wondering if there was anyway to put some
assembally into C source code so that the assembally would be evaluated
exactly as it was written. I'm looking for some sort of standard
function or feature here so I am relitively sure that I am on topic (I
know some people that read this news group can be slightly brutal about
off topic posts). Anyways I'm just looking for a way to put a bit of
assembally into my code to take care of things that I would not be able
to otherwise. Thanks in advanced for any answers.
Nori 12 1490 no*********@gmail.com wrote: Hello everyone. I was wondering if there was anyway to put some assembally into C source code so that the assembally would be evaluated exactly as it was written.
There's no portable way, so it would be off-topic. You'll need to find
a group dedicated to your hardware/compiler combination.
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
On 10 May 2006 14:35:56 -0700, "no*********@gmail.com"
<no*********@gmail.com> wrote: Hello everyone. I was wondering if there was anyway to put some assembally into C source code so that the assembally would be evaluated exactly as it was written. I'm looking for some sort of standard function or feature here so I am relitively sure that I am on topic (I know some people that read this news group can be slightly brutal about off topic posts). Anyways I'm just looking for a way to put a bit of assembally into my code to take care of things that I would not be able to otherwise. Thanks in advanced for any answers. Nori
The question is on-topic, but the answer is no. There is no standard
way of embedding assembly language in C source. Your implementation
may provide extensions to do it, but you'd have to ask in a forum
which discusses that particular implementation.
--
Al Balmer
Sun City, AZ
<no*********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com... Hello everyone. I was wondering if there was anyway to put some assembally into C source code so that the assembally would be evaluated exactly as it was written. I'm looking for some sort of standard function or feature here so I am relitively sure that I am on topic (I know some people that read this news group can be slightly brutal about off topic posts). Anyways I'm just looking for a way to put a bit of assembally into my code to take care of things that I would not be able to otherwise. Thanks in advanced for any answers.
The only "standard" way is to put it in an external routine. Actually I am
not even sire this is standard, but it has to be external.
Given you had some hex machine code could you put that in a string, (or
other array, say ints if you needed word alignment), cast the address of a
string to the address of a function and call the function?
Nori
"David Wade" <g8***@yahoo.com> writes: <no*********@gmail.com> wrote in message news:11**********************@i40g2000cwc.googlegr oups.com... Hello everyone. I was wondering if there was anyway to put some assembally into C source code so that the assembally would be evaluated exactly as it was written. I'm looking for some sort of standard function or feature here so I am relitively sure that I am on topic (I know some people that read this news group can be slightly brutal about off topic posts). Anyways I'm just looking for a way to put a bit of assembally into my code to take care of things that I would not be able to otherwise. Thanks in advanced for any answers.
The only "standard" way is to put it in an external routine. Actually I am not even sire this is standard, but it has to be external.
Given you had some hex machine code could you put that in a string, (or other array, say ints if you needed word alignment), cast the address of a string to the address of a function and call the function?
Most C compilers provide some kind of extension that allows you to
write inline assembly code. Your proposed method uses only standard C
features, but it uses them in an *entirely* non-portable manner.
Using a compiler extension is no less portable, and is *far* more
likely to work and to be maintainable.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Yes, you can do it in C programming for microcontroller. Assembly code
can be inserted at any portion of the C code. You can try it in
microcontroller programming. Here is the link for some help: www.electronics.netmyne.com
Dheroyan2006 wrote: Yes, you can do it in C programming for microcontroller.
Do what? Please include context when posting. Google is most definitely
*not* Usenet. See the Google part of http://clc-wiki.net/wiki/Intro_to_clc for information about it, and the
rest of the page for more about this group.
Assembly code can be inserted at any portion of the C code.
Not standard C it can't, and the way the extensions work vary from
implementation to implementation.
You can try it in microcontroller programming. Here is the link for some help: www.electronics.netmyne.com
Well, going through the tutorial I found, "In any real program, you will
use the gets or fgets functions instead to read text a line at a time."
on page http://www.electronics.netmyne.com/cprogramming7.html
Any tutorial that suggests using gets in real programs should be treated
with a degree of caution.
Going further I see:
int Main()
{
void Display(); // we called function Display
}
C is case sensitive, so using Main rather than main is not going to help
(if the linker is case insensitive, which it is allowed to be, it could
work by luck). Having a function named Main as well as one named main
would be legal, but I would consider it to be very bad practice.
There are other stupid errors as well. So having got further through it,
I would strongly recommend *against* that site.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro: http://clc-wiki.net/wiki/Intro_to_clc
Thants not all...oh no thats not all. This is some of the worst
programming style and structure I have ever seen. Anyplace that writes
source like this: (note: not actually copied)
#include <stdio.h>
main(){
char chr;
printf("hello\n");
for(;;){
scanf("%c", &chr); /* in "real" programs we don't use this */
if(chr==a)
break;
}
}
CANNOT BE TRUSTED!!!
>Thants not all...oh no thats not all. This is some of the worst programming style and structure I have ever seen. Anyplace that writes source like this: (note: not actually copied) #include <stdio.h> main(){ char chr; printf("hello\n"); for(;;){ scanf("%c", &chr); /* in "real" programs we don't use this */ if(chr==a) break;
} }
CANNOT BE TRUSTED!!!
I apologize for my unquoted context.
I was refering to:
Well, going through the tutorial I found, "In any real program, you will use the gets or fgets functions instead to read text a line at a time." on page http://www.electronics.netmyne.com/cprogramming7.html
Any tutorial that suggests using gets in real programs should be treated with a degree of caution.
Going further I see: int Main()
{
void Display(); // we called function Display }
C is case sensitive, so using Main rather than main is not going to help (if the linker is case insensitive, which it is allowed to be, it could work by luck). Having a function named Main as well as one named main would be legal, but I would consider it to be very bad practice.
There are other stupid errors as well. So having got further through it, I would strongly recommend *against* that site.
On 2006-05-11, Flash Gordon <sp**@flash-gordon.me.uk> wrote: C is case sensitive, so using Main rather than main is not going to help (if the linker is case insensitive, which it is allowed to be, it could work by luck). Having a function named Main as well as one named main would be legal, but I would consider it to be very bad practice.
Actually, that would not be 'legal' unless one or both of them are
static. A program containing multiple external identifiers that are the
same (case-insensitive) in the first six characters is not strictly
conforming.
Jordan Abel wrote: On 2006-05-11, Flash Gordon <sp**@flash-gordon.me.uk> wrote: C is case sensitive, so using Main rather than main is not going to help (if the linker is case insensitive, which it is allowed to be, it could work by luck). Having a function named Main as well as one named main would be legal, but I would consider it to be very bad practice.
Actually, that would not be 'legal' unless one or both of them are static. A program containing multiple external identifiers that are the same (case-insensitive) in the first six characters is not strictly conforming.
I meant would be legal if the link phase was case sensitive, which it is
allowed to be. Not strictly conforming, I agree.
The important thing being it should not be done, and a site doing it in
examples is definitely one to avoid using.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro: http://clc-wiki.net/wiki/Intro_to_clc
Keith Thompson wrote: "David Wade" <g8***@yahoo.com> writes: <no*********@gmail.com> wrote in message news:11**********************@i40g2000cwc.googlegr oups.com... Hello everyone. I was wondering if there was anyway to put some assembally into C source code so that the assembally would be evaluated exactly as it was written. I'm looking for some sort of standard function or feature here so I am relitively sure that I am on topic (I know some people that read this news group can be slightly brutal about off topic posts). Anyways I'm just looking for a way to put a bit of assembally into my code to take care of things that I would not be able to otherwise. Thanks in advanced for any answers. The only "standard" way is to put it in an external routine. Actually I am not even sire this is standard, but it has to be external.
Given you had some hex machine code could you put that in a string, (or other array, say ints if you needed word alignment), cast the address of a string to the address of a function and call the function?
Most C compilers provide some kind of extension that allows you to write inline assembly code. Your proposed method uses only standard C features, but it uses them in an *entirely* non-portable manner. Using a compiler extension is no less portable, and is *far* more likely to work and to be maintainable.
We did have systems nearly 30 years ago which required this style of
(octal) code to access system clock and the like. I never heard anyone
lament the advent of more portable ways, or saw anyone go back.
Jordan Abel <ra*******@gmail.com> writes: On 2006-05-11, Flash Gordon <sp**@flash-gordon.me.uk> wrote: C is case sensitive, so using Main rather than main is not going to help (if the linker is case insensitive, which it is allowed to be, it could work by luck). Having a function named Main as well as one named main would be legal, but I would consider it to be very bad practice.
Actually, that would not be 'legal' unless one or both of them are static. A program containing multiple external identifiers that are the same (case-insensitive) in the first six characters is not strictly conforming.
In C90; in C99, the limit is 31 characters, and upper and lower case
are distinct.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mat |
last post by:
Hi,
I have a system that uploads images as BLOBs in a database. I also
have a function that I use to resize uploaded images before saving as
files. I would like to combine these two by resising...
|
by: Marko Poutiainen |
last post by:
Situation:
We had to make our SQLServer 2000 database multi-lingual. That is, certain
things (such as product names) in the database should be shown in the
language the user is using (Finnish,...
|
by: Joachim Klassen |
last post by:
Hi all,
first apologies if this question looks the same as another one I recently
posted - its a different thing but for the same szenario:-).
We are having performance problems when...
|
by: Alan Silver |
last post by:
Hello,
VWD Express seems obsessed with inserting loads of spaces at the start
of each line whenever you drag controls into the source view. I guess
this is MS' idea of making the source code...
|
by: Pushpendra Vats |
last post by:
Hi ,
I am trying to insert records into database. I am trying
to write the following code.
On button1 click event i am inserting five records and
after that i am calling the update method of...
| |
by: pd123 |
last post by:
I'm new to C# and .net and I'm trying to create a form that will register users in a sql server database. I have the following code but when I run the code I get an error "
The name 'Peter' is...
|
by: tom c |
last post by:
I am going through "Walkthrough: Editing and Inserting Data in Web
Pages with the DetailsView Web Server Control" found at
http://msdn2.microsoft.com/en-us/library/sdba1d59.aspx
I am using...
|
by: toyin |
last post by:
hello, pls help look through this code its not inserting the record in dataset into the another database.
i want to insert the row in the dataset into another table in another database.
pls help....
|
by: pramodkh |
last post by:
Hi All
I am trying to match a pattern in a file and insert a line. If the pattern matches then insert a line before the matching pattern line.
for example,
I have the following content in a...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |