473,396 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

memset o/p not correct

Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{

int maxpat[80];
memset(maxpat,-1,80);

for(i=0;i<80;i++)
printf("%d\t",maxpat[i]);

return EXIT_SUCCESS;
}

but i am getting o/p as

-1 -1 -1 -1 -1 -1 -1 -1
-1 -1
-1 -1 -1 -1 -1 -1 -1 -1
-1 -1
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086

"D:\siju\lcc6\noisedisp.exe"
Return code 0
Execution time 0.048 seconds
Press any key to continue...

why is this so..????
Jun 27 '08 #1
46 1805
sorry I forgot to declare i , but still the o/p is same

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);
for(i=0;i<80;i++)
printf("%d\t",maxpat[i]);
return EXIT_SUCCESS;
}
Jun 27 '08 #2
On Apr 20, 2:28*am, aark...@gmail.com wrote:
Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1

*#include <string.h>
*#include <stdio.h>
*#include <stdlib.h>

*int main(void)
*{

* *int maxpat[80];
* *memset(maxpat,-1,80);

* *for(i=0;i<80;i++)
* *printf("%d\t",maxpat[i]);

* *return EXIT_SUCCESS;
*}

but i am getting o/p as

-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1
-1 * * *-1
-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1
-1 * * *-1
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086

"D:\siju\lcc6\noisedisp.exe"
Return code 0
Execution time 0.048 seconds
Press any key to continue...

why is this so..????
sorry I forgot to declare i, but still the o/p is same
Jun 27 '08 #3
aa*****@gmail.com wrote:
Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{

int maxpat[80];
memset(maxpat,-1,80);
You are only setting the first 80 bytes of the the array, not 80 ints.

--
Ian Collins.
Jun 27 '08 #4

<aa*****@gmail.comwrote in message
news:c7**********************************@b5g2000p ri.googlegroups.com...
Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{

int maxpat[80];
memset(maxpat,-1,80);
You're setting 80 bytes. The array is bigger than that (80*sizeof(int)).
Try:

memset(maxpat,-1,sizeof maxpat);

--
Bart

Jun 27 '08 #5
aa*****@gmail.com wrote, On 19/04/08 22:31:
sorry I forgot to declare i , but still the o/p is same

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);
<snip>

Check the definition of memset in your reference book, it sets a
specified number of *bytes*. This also means that having corrected the
error (sizeof *maxpat is your friend) it won't be portable to
implementations using 1s complement or sign-magnitude if you can find
such an implementation.
--
Flash Gordon
Jun 27 '08 #6
aa*****@gmail.com wrote:
Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
int maxpat[80];
memset(maxpat,-1,80);
As the others have pointed out, it sets each byte to the value. There's
almost no way to do what you want with memset(), unless you happen to
be on a machine that had one-byte ints.

To set each int in the array to -1, you need a loop. Better yet,
explain WHY you want to do this. There may be a better construct.

Brian
Jun 27 '08 #7
In article <66*************@mid.individual.net>,
Default User <de***********@yahoo.comwrote:
> int maxpat[80];
memset(maxpat,-1,80);
>As the others have pointed out, it sets each byte to the value. There's
almost no way to do what you want with memset(), unless you happen to
be on a machine that had one-byte ints.
Unless you really on the machines being 2s-complement, which is true
of all general-purpose computers today.

-- Richard
--
:wq
Jun 27 '08 #8
"Default User" <de***********@yahoo.comwrites:
aa*****@gmail.com wrote:
>Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
> int maxpat[80];
memset(maxpat,-1,80);

As the others have pointed out, it sets each byte to the value. There's
almost no way to do what you want with memset(), unless you happen to
be on a machine that had one-byte ints.

To set each int in the array to -1, you need a loop. Better yet,
explain WHY you want to do this. There may be a better construct.
I would be interested to hear how you knowing WHY he needs to set a
sequence of ints to a single value would in any way "optimise" your
advice.

>
Brian
Jun 27 '08 #9
Richard Tobin wrote:
Default User <de***********@yahoo.comwrote:
>> int maxpat[80];
memset(maxpat,-1,80);
>As the others have pointed out, it sets each byte to the value.
There's almost no way to do what you want with memset(), unless
you happen to be on a machine that had one-byte ints.

Unless you really on the machines being 2s-complement, which is
true of all general-purpose computers today.
What's the point of the foolishness, when:

#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;

handles it accurately and portably, doesn't care about what VALUE
is, and preserves the value of MPSIZE for any other uses. Note
that the bit of code above doesn't have to be in the scope of
maxpat, rather it can receive it as a parameter.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #10
Richard wrote:
) In article <66*************@mid.individual.net>,
) Default User <de***********@yahoo.comwrote:
)
)> int maxpat[80];
)> memset(maxpat,-1,80);
)
)>As the others have pointed out, it sets each byte to the value. There's
)>almost no way to do what you want with memset(), unless you happen to
)>be on a machine that had one-byte ints.
)
) Unless you really on the machines being 2s-complement, which is true
) of all general-purpose computers today.

And then he wants to set the entire array to -2 instead.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Jun 27 '08 #11
CBFalconer <cb********@yahoo.comwrites:
[...]
#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)
It doesn't matter in this case, but it's a good habit.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #12
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
[...]
> #define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)
It doesn't matter in this case, but it's a good habit.
Better still

const int value = -1;

--
Ian Collins.
Jun 27 '08 #13
Ian Collins wrote:
Keith Thompson wrote:
>CBFalconer <cb********@yahoo.comwrites:

[...]
>> #define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)

It doesn't matter in this case, but it's a good habit.

Better still

const int value = -1;
The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #14
CBFalconer wrote:
Ian Collins wrote:
>Keith Thompson wrote:
>>CBFalconer <cb********@yahoo.comwrites:

[...]

#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)

It doesn't matter in this case, but it's a good habit.
Better still

const int value = -1;

The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.
I think you've topped your own stupidity this time.

--
Ian Collins.
Jun 27 '08 #15
On Apr 20, 4:43*am, "Default User" <defaultuse...@yahoo.comwrote:
To set each int in the array to -1, you need a loop. Better yet,
explain WHY you want to do this. There may be a better construct.

actually it was for doing the following program
/*program to find the maximum matching pattern in the string*/

#include < string.h >
#include < stdio.h >
#include < stdlib.h >

void findmaxpat(char*,char*,int*);
void printmaxpat(char*,int*);

int main(void)
{

int i;

char s[80];
char pat[80];
int maxpat[80];
memset(maxpat,-1,80 * sizeof(int));

printf("\n Enter the main string:: ");
gets(s);

while(*s)
{
printf("\n Enter the pattern to be searched:: ");
gets(pat);

findmaxpat(s,pat,maxpat);
printmaxpat(s,maxpat);

printf("\n Enter the main string:: ");
gets(s);
}

return EXIT_SUCCESS;
}

void findmaxpat(char* s,char* pat,int* maxpat)
{

int i;

for(i=0;*s && *pat;i++,s++)

if(*s == *pat)
*maxpat++ = i,pat++;

if(!*pat)
puts("whole pattern found...");

else
printf("pattern not found in the string ");

*maxpat = -1;

}
void printmaxpat(char* s,int* maxpat)
{

char *temp = s;

(*maxpat == -1)? printf("\"%s\"\n",s) :puts(s);

for(;*temp && *maxpat != -1;++temp)
{

if(temp-s == *maxpat)
{
printf("^");
maxpat++;
}
else
printf("%c",' ');
}

puts("");
}

Jun 27 '08 #16

"Flash Gordon" <sp**@flash-gordon.me.ukschreef in bericht
news:08************@news.flash-gordon.me.uk...
aa*****@gmail.com wrote, On 19/04/08 22:31:
>sorry I forgot to declare i , but still the o/p is same

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);

<snip>

Check the definition of memset in your reference book, it sets a specified
number of *bytes*. This also means that having corrected the error (sizeof
*maxpat is your friend) it won't be portable to implementations using 1s
complement or sign-magnitude if you can find such an implementation.
Why not? The program will fill maxpat with whatever -1 represents and print
that.
Perfectly portable

Jun 27 '08 #17
"Serve Laurijssen" <ni@hao.comwrites:
"Flash Gordon" <sp**@flash-gordon.me.ukschreef in bericht
news:08************@news.flash-gordon.me.uk...
>aa*****@gmail.com wrote, On 19/04/08 22:31:
>>sorry I forgot to declare i , but still the o/p is same

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);

<snip>

Check the definition of memset in your reference book, it sets a
specified number of *bytes*. This also means that having corrected
the error (sizeof *maxpat is your friend) it won't be portable to
implementations using 1s complement or sign-magnitude if you can
find such an implementation.

Why not? The program will fill maxpat with whatever -1 represents and
print that.
Perfectly portable
The OP expressed his desire to set all *integers* to -1. Which it will
do if he changed the 80 in the memset to 80*sizeof(int) and the
architecture was 2's complement.

Jun 27 '08 #18
On Sun, 20 Apr 2008 17:44:54 +0200, "Serve Laurijssen" <ni@hao.com>
wrote:
>
"Flash Gordon" <sp**@flash-gordon.me.ukschreef in bericht
news:08************@news.flash-gordon.me.uk...
>aa*****@gmail.com wrote, On 19/04/08 22:31:
>>sorry I forgot to declare i , but still the o/p is same

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);

<snip>

Check the definition of memset in your reference book, it sets a specified
number of *bytes*. This also means that having corrected the error (sizeof
*maxpat is your friend) it won't be portable to implementations using 1s
complement or sign-magnitude if you can find such an implementation.

Why not? The program will fill maxpat with whatever -1 represents and print
that.
Perfectly portable
What is the representation of -1 in a sign magnitude system with a
32-bit int and an 8 bit char? How much of that representation will
memset use? What will be the resulting bit pattern in one of the
elements of maxpat? What value will this represent? Will this
achieve the intended objective as posed in the original post? How is
this value different from a 2s-complement machine? From a
1s-complement machine?
Remove del for email
Jun 27 '08 #19
On Sun, 20 Apr 2008 08:06:30 -0700 (PDT), aa*****@gmail.com wrote:
>On Apr 20, 4:43*am, "Default User" <defaultuse...@yahoo.comwrote:
>To set each int in the array to -1, you need a loop. Better yet,
explain WHY you want to do this. There may be a better construct.


actually it was for doing the following program
/*program to find the maximum matching pattern in the string*/

#include < string.h >
#include < stdio.h >
#include < stdlib.h >

void findmaxpat(char*,char*,int*);
void printmaxpat(char*,int*);

int main(void)
{

int i;

char s[80];
char pat[80];
int maxpat[80];
memset(maxpat,-1,80 * sizeof(int));

printf("\n Enter the main string:: ");
gets(s);

while(*s)
{
printf("\n Enter the pattern to be searched:: ");
gets(pat);

findmaxpat(s,pat,maxpat);
printmaxpat(s,maxpat);

printf("\n Enter the main string:: ");
gets(s);
}

return EXIT_SUCCESS;
}

void findmaxpat(char* s,char* pat,int* maxpat)
{

int i;

for(i=0;*s && *pat;i++,s++)

if(*s == *pat)
*maxpat++ = i,pat++;
Let s contain "abcde" and pat contain "ade".
>
if(!*pat)
puts("whole pattern found...");
This is what you print and may actually reflect what you want but it
is not the normal meaning of the term "pattern matching". For a
pattern match to occur, s would have to contain the letters a-d-e
consecutively in sequence.

In terms of c functions, pattern matching is strstr. What you have is
similar to multiple calls to strpbrk or strcspn
>
else
printf("pattern not found in the string ");

*maxpat = -1;

}
void printmaxpat(char* s,int* maxpat)
{

char *temp = s;

(*maxpat == -1)? printf("\"%s\"\n",s) :puts(s);

for(;*temp && *maxpat != -1;++temp)
{

if(temp-s == *maxpat)
You need to learn to indent your code. It will save you a ton of
trouble later on.
>{
printf("^");
maxpat++;
}
else
printf("%c",' ');
Strange that above you put the constant character in the format string
while hear you printed it with %c. In both cases, putc would be the
function of choice.
>}

puts("");
}

Remove del for email
Jun 27 '08 #20
Serve Laurijssen wrote:
...
Why not? The program will fill maxpat with whatever -1 represents and
print that.
Perfectly portable
The program will re-interpret the memory occupied by 'maxpat' as an array of
characters, all of which will be filled with the value of '(unsigned char) -1'.
There's nothing portable there.

--
Best regards,
Andrey Tarasevich
Jun 27 '08 #21
Richard Tobin wrote:
...
Unless you really on the machines being 2s-complement, which is true
of all general-purpose computers today.
...
Being 2's-complement is not enough. You also need the machine to have either no
padding bits in 'int' or accepting the resultant configuration of padding bits
as valid. It is also true for all general-purpose computers today, but
nevertheless...

--
Best regards,
Andrey Tarasevich
Jun 27 '08 #22
CBFalconer <cb********@yahoo.comwrites:
Ian Collins wrote:
>Keith Thompson wrote:
>>CBFalconer <cb********@yahoo.comwrites:

[...]

#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)

It doesn't matter in this case, but it's a good habit.

Better still

const int value = -1;
Yes, that's fine in this case, but only because it's not used in a
context that requires a constant expression. If it were, you'd need
to use either a macro or the enum trick:
enum { VALUE = -1 };
which works only for values of type int.
The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.
It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

Consider the following version of the OP's program:

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
#define MPSIZE 80
const int value = -1;
int maxpat[MPSIZE];
int i;

for (i = 0; i < MPSIZE; i++) {
maxpat[i] = value;
}

for(i = 0; i < MPSIZE; i++) {
if (i 0 && i % 8 == 0) {
putchar('\n');
}
printf("%6d ", maxpat[i]);
}
putchar('\n');

return EXIT_SUCCESS;
}

It works correctly, and IMHO the use of a const int object isn't even
a style problem. And I would expect any decent compiler to generate
the same code as for a similar program using "#define VALUE (-1)"
<OT>; gcc does so at "-O1" or higher</OT>.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #23

"Andrey Tarasevich" <an**************@hotmail.comwrote in message
news:J7******************************@comcast.com. ..
Richard Tobin wrote:
>...
Unless you really on the machines being 2s-complement, which is true
of all general-purpose computers today.
...

Being 2's-complement is not enough. You also need the machine to have
either no padding bits in 'int' or accepting the resultant configuration
of padding bits as valid. It is also true for all general-purpose
computers today, but nevertheless...
If I worried about all this stuff years ago I would never have got anything
done, or it would have been too slow to be useful.

It's possible the OP knows what his target architecture is using for number
representation.

The OP's initial problem was the wrong N parameter to memset, he said
nothing about the rest of it, and in fact it looked like the 80 bytes of the
array he did manage to set were properly initialised to -1.

But no-one has (yet) mentioned the use of gets() in his later message which
usually is picked up quickly here.

--
Bart

Jun 27 '08 #24
aa*****@gmail.com writes:
On Apr 20, 4:43*am, "Default User" <defaultuse...@yahoo.comwrote:
>To set each int in the array to -1, you need a loop. Better yet,
explain WHY you want to do this. There may be a better construct.

actually it was for doing the following program

/*program to find the maximum matching pattern in the string*/

#include < string.h >
#include < stdio.h >
#include < stdlib.h >
You can't have spaces after the '<' or before the '>' in a #include
directive. My compiler complains that it can't find headers
" string.h ", " stdio.h ", or " stdlib.h ". I'm surprised yours
accepts it, but since the interpretation of header names is
implementation-specific, it's possible. But the correct directives
are:

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

Your article was encoded as "quoted-printable", which means that '='
characters are encoded as "=3D". If you can persuade your newsreaqder
to post plain text rather than quoted-printable, it would be helpful.
Possibly my own newsreader should have done the translation when
saving the file, but there's nothing in what you posted that really
requires anything more elaborate than a plain-text encoding.
void findmaxpat(char*,char*,int*);
void printmaxpat(char*,int*);

int main(void)
{

int i;
You declare ``i'', but you never use it.

Please, please, *PLEASE* indent your code properly. It's much more
difficult to read when everything is shoved over against the left
margin.

It's possible you did indent your code, and your newsreader or
something else killed it. If so, please try to solve that problem.
If you're using tabs for indentation, try using just spaces. And make
sure you're using an editor that's designed to work with source code.

[...]
gets(s);
Never use gets(). Never. See question 12.23 in the comp.lang.c FAQ,
<http://c-faq.com/>. (The FAQ is an excellent resource; reading the
whole thing would not be a waste of your time.)

[...]
(*maxpat == -1)? printf("\"%s\"\n",s) :puts(s);
This is an entirely gratuitous use of the conditional operator; it
does nothing but make your code harder to read. Just use an if
statement:

if (*maxpat == -1)
printf("\"%s\"\n",s);
else
puts(s);

Personally, I always use braces, even for a single statement:

if (*maxpat == -1) {
printf("\"%s\"\n",s);
}
else {
puts(s);
}

but that's a fairly minor style point; I recommend it, but feel free
to make your own choice. Using "?:" rather than if/else in a
statement context, on the other hand, is just silly.

if(temp-s == *maxpat)
{
printf("^");
maxpat++;
}
else
printf("%c",' ');
}

puts("");
}
There are two main approaches to writing information to stdout. You
can use printf for everything, which is a simpler approach (as long as
you're careful about '%' characters with the format string). Or you
can make use of the make use of the wider variety of output functions,
such as puts, fputs, putchar, and so forth. Always using printf had
the advantage that there's only one function to learn. But here,
since you're using puts anyway, I'll suggest that the above 3 output
calls could be written as:

putchar('^');
...
putchar(' ');
...
putchar('\n');

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #25
On Sun, 20 Apr 2008 15:44:54 UTC, "Serve Laurijssen" <ni@hao.com>
wrote:
>
"Flash Gordon" <sp**@flash-gordon.me.ukschreef in bericht
news:08************@news.flash-gordon.me.uk...
aa*****@gmail.com wrote, On 19/04/08 22:31:
sorry I forgot to declare i , but still the o/p is same

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);
<snip>

Check the definition of memset in your reference book, it sets a specified
number of *bytes*. This also means that having corrected the error (sizeof
*maxpat is your friend) it won't be portable to implementations using 1s
complement or sign-magnitude if you can find such an implementation.

Why not? The program will fill maxpat with whatever -1 represents and print
that.
No, it will not - except sizeof char is equal sizeo fint on his
mashine and then it would work perfectly. But the OP shows that on his
mashine is sizeof char < sizeof int, so the program fails miserably as
it shoud.
Perfectly portable
No, perfectly importable as the program requires that sizeof char ==
sizeof int, what is not the case on his implementation wand will not
on mamy other ones too and will occure simply undefined behavior on
others, because the standard allows padding bits in ints and between
bytes, so storing a sequence of (char) (int) -1 is not identical as
storing (int) -i in an array of ints.

memset strores a number of chars into an array of chars and noit as
the OP thinks a number of ints into an array of its. So the program is
completely absolute importable anyway.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
Jun 27 '08 #26
On Sun, 20 Apr 2008 17:08:09 UTC, Richard <de***@gmail.comwrote:
>
The OP expressed his desire to set all *integers* to -1. Which it will
do if he changed the 80 in the memset to 80*sizeof(int) and the
architecture was 2's complement.
Which will never do! Because
- the array is defined as an array of int.

memset does not handle ints,
- it gets a pointer to char which can not be an array of int
- it gets an single int that gets shorten to an single char to be
stored into a single char
- it gets a number of char that is not a number of ints when sizeof
char is < sizeof int.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
Jun 27 '08 #27
On Sat, 19 Apr 2008 21:45:16 UTC, "Bartc" <bc@freeuk.comwrote:
>
<aa*****@gmail.comwrote in message
news:c7**********************************@b5g2000p ri.googlegroups.com...
Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{

int maxpat[80];
memset(maxpat,-1,80);

You're setting 80 bytes. The array is bigger than that (80*sizeof(int)).
Try:

memset(maxpat,-1,sizeof maxpat);
Does even fail on any mashine that uses padding bits because a
sequence of bytes of (char) (int) -1 mut not give the same bitpattern
as (int) -1 as the C standard forbids explicity to store a value of
one type and read of another one:

union {
char c[2];
int i;
} s;

s.c[0] = -1;
s.c[1] = -1;

if (s.i != -1)
/* trap/segfault or whatever the iplementation does on illegal
memory access */

memset handles bytes, not ints. A value of int is not identical with a
sequence of char on some mashines.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
Jun 27 '08 #28
On Sun, 20 Apr 2008 11:15:51 UTC, Ian Collins <ia******@hotmail.com>
wrote:
CBFalconer wrote:
Ian Collins wrote:
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:

[...]

#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)

It doesn't matter in this case, but it's a good habit.
Better still

const int value = -1;
The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.
I think you've topped your own stupidity this time.
You are faulty. You have to learn the difference between a readonly
variable (const) and a const (letter, number).

When a variable classified as const were really a const and not only a
variable classified so then it wre legal to have a readonly variable
on the place a label requires a const.

const int i;

i: is illegal becaue i is not a const.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
Jun 27 '08 #29
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
>Ian Collins wrote:
>>Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:

[...]

#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;
>
for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)

It doesn't matter in this case, but it's a good habit.

Better still

const int value = -1;

Yes, that's fine in this case, but only because it's not used in
a context that requires a constant expression. If it were, you'd
need to use either a macro or the enum trick:
enum { VALUE = -1 };
which works only for values of type int.
>The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.

It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)
So what? Among other things, it can tend to generate poor code.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address. And, once you have the constant
defined, it is usable elsewhere and is guaranteed to match values.
All I am saying is that the use of const here is a horrible
misuse. However the enum is a valid means of generating that
constant.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #30
CBFalconer wrote:
Keith Thompson wrote:
>CBFalconer <cb********@yahoo.comwrites:
>>Ian Collins wrote:
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
>
[...]
>
> #define MPSIZE 80
> #define VALUE -1
> int maxpat[MPSIZE], i;
>>
> for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]
>
Quibble:
#define VALUE (-1)
>
It doesn't matter in this case, but it's a good habit.
Better still

const int value = -1;
Yes, that's fine in this case, but only because it's not used in
a context that requires a constant expression. If it were, you'd
need to use either a macro or the enum trick:
enum { VALUE = -1 };
which works only for values of type int.
>>The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.
It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.
Not on any compiler I've used recently. It generates the exact same
code as a literal constant.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address.
Nope.
And, once you have the constant
defined, it is usable elsewhere and is guaranteed to match values.
It also pollutes any scope where the #define is visible.
All I am saying is that the use of const here is a horrible
misuse.
It isn't, it's perfectly valid. It's the only way if you want to manage
the scope of the constant.
However the enum is a valid means of generating that
constant.
For integer types.

--
Ian Collins.
Jun 27 '08 #31
Keith Thompson wrote:
Your article was encoded as "quoted-printable", which means that '='
characters are encoded as "=3D". If you can persuade your newsreaqder
to post plain text rather than quoted-printable, it would be helpful.
Possibly my own newsreader should have done the translation when
saving the file, but there's nothing in what you posted that really
requires anything more elaborate than a plain-text encoding.
He posts from Google Groups, and that's one of the "features" of that
system. I started displaying the User-Agent header line so that I could
tell when a message was from GG (it will be set to G2/1.0).
It's possible you did indent your code, and your newsreader or
something else killed it. If so, please try to solve that problem.
If you're using tabs for indentation, try using just spaces. And make
sure you're using an editor that's designed to work with source code.
GG might eat tabs, or he might have neglected to indent. Spaces work
ok.


Brian
Jun 27 '08 #32
CBFalconer <cb********@yahoo.comwrites:
Keith Thompson wrote:
>CBFalconer <cb********@yahoo.comwrites:
>>Ian Collins wrote:
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
>
[...]
>
> #define MPSIZE 80
> #define VALUE -1
> int maxpat[MPSIZE], i;
>>
> for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]
>
Quibble:
#define VALUE (-1)
>
It doesn't matter in this case, but it's a good habit.

Better still

const int value = -1;

Yes, that's fine in this case, but only because it's not used in
a context that requires a constant expression. If it were, you'd
need to use either a macro or the enum trick:
enum { VALUE = -1 };
which works only for values of type int.
>>The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.

It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.
Your views (incorrect at that) on compiler specifics are clearly off
topic. I am sure you would be the first to point that out to others who
were to post such rubbish.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address. And, once you have the constant
defined, it is usable elsewhere and is guaranteed to match values.
All I am saying is that the use of const here is a horrible
misuse. However the enum is a valid means of generating that
constant.

Jun 27 '08 #33
Richard wrote:
CBFalconer <cb********@yahoo.comwrites:
>Keith Thompson wrote:
>>CBFalconer <cb********@yahoo.comwrites:
Ian Collins wrote:
Keith Thompson wrote:
>CBFalconer <cb********@yahoo.comwrites:
>>
>[...]
>>
>> #define MPSIZE 80
>> #define VALUE -1
>> int maxpat[MPSIZE], i;
>>>
>> for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
>[...]
>>
>Quibble:
> #define VALUE (-1)
>>
>It doesn't matter in this case, but it's a good habit.
>
Better still
>
const int value = -1;

Yes, that's fine in this case, but only because it's not used in
a context that requires a constant expression. If it were, you'd
need to use either a macro or the enum trick:
enum { VALUE = -1 };
which works only for values of type int.

The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.

It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.

Your views (incorrect at that) on compiler specifics are clearly off
topic.
What compiler specifics?

<snip>

Jun 27 '08 #34

santosh <sa*********@gmail.comwrites:
Richard wrote:
>CBFalconer <cb********@yahoo.comwrites:
>>Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
Ian Collins wrote:
>Keith Thompson wrote:
>>CBFalconer <cb********@yahoo.comwrites:
>>>
>>[...]
>>>
>>> #define MPSIZE 80
>>> #define VALUE -1
>>> int maxpat[MPSIZE], i;
>>>>
>>> for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
>>[...]
>>>
>>Quibble:
>> #define VALUE (-1)
>>>
>>It doesn't matter in this case, but it's a good habit.
>>
>Better still
>>
>const int value = -1;

Yes, that's fine in this case, but only because it's not used in
a context that requires a constant expression. If it were, you'd
need to use either a macro or the enum trick:
enum { VALUE = -1 };
which works only for values of type int.

The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.

It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.

Your views (incorrect at that) on compiler specifics are clearly off
topic.

What compiler specifics?
Please read the post I replied to. Hint : Falconer would not tolerate
the word "can" since code generation is alien to the standard.

For some reason known only to yourself you then continued to snip all
the "possibles" Falconer posted which are clearly guesswork and liable
to be compiler specific.
Jun 27 '08 #35
CBFalconer wrote:
Keith Thompson wrote:
>...
It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address.
No, actually. From the point of view of low-level semantics (i.e. code
generation) there's absolutely no difference between const-qualified 'int'
object and a manifest constant (from the #define) in C. A 'const int' object can
easily be loaded as an immediate value. There's no need to generate a memory
read. What made you to conclude than a memory read would be necessary?

--
Best regards,
Andrey Tarasevich
Jun 27 '08 #36
Ian Collins wrote:
CBFalconer wrote:
However the enum is a valid means of generating that
constant.

For integer types.
....in the range of int.

--
Peter
Jun 27 '08 #37
Richard wrote:
"Default User" <de***********@yahoo.comwrites:
>aa*****@gmail.com wrote:
>>Hi,

the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
>> int maxpat[80];
memset(maxpat,-1,80);

As the others have pointed out, it sets each byte to the value. There's
almost no way to do what you want with memset(), unless you happen to
be on a machine that had one-byte ints.

To set each int in the array to -1, you need a loop. Better yet,
explain WHY you want to do this. There may be a better construct.

I would be interested to hear how you knowing WHY he needs to set a
sequence of ints to a single value would in any way "optimise" your
advice.
Because it sometimes turns out that the /actual/ problem can be
solved in a different, perhaps better, way. Have you not met
problems that can be easily solved one higher level of
abstraction than their symptoms?

--
"What would that matter, if it made a good book?" /Gaudy Night/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Jun 27 '08 #38
"Herbert Rosenau" <os****@pc-rosenau.dewrites:
On Sun, 20 Apr 2008 11:15:51 UTC, Ian Collins <ia******@hotmail.com>
wrote:
>CBFalconer wrote:
Ian Collins wrote:
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:

[...]

#define MPSIZE 80
#define VALUE -1
int maxpat[MPSIZE], i;

for (i = 0; i < MPSIZE; i++) maxpat[i] = VALUE;
[...]

Quibble:
#define VALUE (-1)

It doesn't matter in this case, but it's a good habit.
Better still

const int value = -1;

The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.
I think you've topped your own stupidity this time.
You are faulty. You have to learn the difference between a readonly
variable (const) and a const (letter, number).
You mean between a readonly variable (const) and a *constant*.
(Though I prefer to refer to the former as a read-only *object*, just
to avoid the confusion of a "variable" that isn't allowed to vary.)

But the point is that in the above code a const-qualified object will
work; the context is not one that requires a constant expression.

Even though the word "const" is derived from "constant", IMHO it's
best to pretend that "const" is *not* an abbreviation for "constant",
and particularly to avoid using the two words interchangeably.
When a variable classified as const were really a const and not only a
variable classified so then it wre legal to have a readonly variable
on the place a label requires a const.

const int i;

i: is illegal becaue i is not a const.
Um, do you think you could rephrase that?

Oddly enough, the declaration
const int i;
is legal, though not at all useful (at least at block scope).

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #39
Ian Collins <ia******@hotmail.comwrites:
CBFalconer wrote:
[...]
>However the enum is a valid means of generating that
constant.
For integer types.
Only for type int, actually. This:

enum { too_big = INT_MAX + 1 };

is invalid (though I'm not sure which kind of invalid it is).

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #40
Herbert Rosenau wrote:
On Sun, 20 Apr 2008 11:15:51 UTC, Ian Collins <ia******@hotmail.com>
wrote:
>CBFalconer wrote:
>>The quibble is fine, but this last is a horror. We want a
constant, not a pre-initialized int. If you want c++, use the
appropriate newsgroup.
I think you've topped your own stupidity this time.
You are faulty. You have to learn the difference between a readonly
variable (const) and a const (letter, number).
Nonsense. Use of const int was correct in this situation.
When a variable classified as const were really a const and not only a
variable classified so then it wre legal to have a readonly variable
on the place a label requires a const.
I don't really understand that sentence, care to try again?
const int i;

i: is illegal becaue i is not a const.
It's legal by C's daft const rules, but useless.

--
Ian Collins.
Jun 27 '08 #41
Keith Thompson wrote:
Ian Collins <ia******@hotmail.comwrites:
>CBFalconer wrote:
[...]
>>However the enum is a valid means of generating that
constant.
For integer types.

Only for type int, actually. This:

enum { too_big = INT_MAX + 1 };

is invalid (though I'm not sure which kind of invalid it is).
Probably the invalid type...

Which all goes to strengthen my case that an initialised, const
qualified variable is the best choice for anything other than a compile
time constant.

--
Ian Collins.
Jun 27 '08 #42
On Mon, 21 Apr 2008 01:24:35 -0700, Keith Thompson wrote:
This:

enum { too_big = INT_MAX + 1 };

is invalid (though I'm not sure which kind of invalid it is).
It's a constraint violation, according to the interpretation at
<http://open-std.org/JTC1/SC22/WG14/www/docs/dr_031.html>
Jun 27 '08 #43

"Barry Schwarz" <sc******@dqel.comschreef in bericht
news:b6********************************@4ax.com...
What is the representation of -1 in a sign magnitude system with a
32-bit int and an 8 bit char? How much of that representation will
memset use? What will be the resulting bit pattern in one of the
elements of maxpat? What value will this represent? Will this
achieve the intended objective as posed in the original post? How is
this value different from a 2s-complement machine? From a
1s-complement machine?
yes yes I dont think you all understand me, but never mind

>

Remove del for email
Jun 27 '08 #44
Andrey Tarasevich wrote:
CBFalconer wrote:
>Keith Thompson wrote:
>>...
It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address.

No, actually. From the point of view of low-level semantics (i.e.
code generation) there's absolutely no difference between const-
qualified 'int' object and a manifest constant (from the #define)
in C. A 'const int' object can easily be loaded as an immediate
value. There's no need to generate a memory read. What made you to
conclude than a memory read would be necessary?
Because a const qualified object is simply marked as read-only.
There are various ways of getting around this and arranging to
change what that object is holding. At which point any code that
treats its value as being a constant is WRONG.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #45
CBFalconer wrote:
Andrey Tarasevich wrote:
>CBFalconer wrote:
>>Keith Thompson wrote:
...
It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)
So what? Among other things, it can tend to generate poor code.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address.
No, actually. From the point of view of low-level semantics (i.e.
code generation) there's absolutely no difference between const-
qualified 'int' object and a manifest constant (from the #define)
in C. A 'const int' object can easily be loaded as an immediate
value. There's no need to generate a memory read. What made you to
conclude than a memory read would be necessary?

Because a const qualified object is simply marked as read-only.
There are various ways of getting around this and arranging to
change what that object is holding. At which point any code that
treats its value as being a constant is WRONG.
No, the code that's "getting around this" is wrong. Once you mess about
with the value of a const qualified variable, you unleash the demons of
Undefined Behaviour.

--
Ian Collins.
Jun 27 '08 #46
CBFalconer <cb********@yahoo.comwrites:
Andrey Tarasevich wrote:
>CBFalconer wrote:
>>Keith Thompson wrote:
...
It's perfect valid C. (The fact that it's also valid C++, and that
C++'s "const" is more flexible that C's, hardly seems relevant.)

So what? Among other things, it can tend to generate poor code.
The real constant (from the #define) can be loaded as an immediate
value. The improper const requires loading an address and then
loading a value from that address.

No, actually. From the point of view of low-level semantics (i.e.
code generation) there's absolutely no difference between const-
qualified 'int' object and a manifest constant (from the #define)
in C. A 'const int' object can easily be loaded as an immediate
value. There's no need to generate a memory read. What made you to
conclude than a memory read would be necessary?

Because a const qualified object is simply marked as read-only.
There are various ways of getting around this and arranging to
change what that object is holding. At which point any code that
treats its value as being a constant is WRONG.
Ok, consider this:

#include <stdio.h>
int main(void)
{
const int x = 42;

/* ... */

printf("x = %d\n", x);
return 0;
}

Can you think of something you could insert in place of the comment
that would change the value of x *without invoking undefined
behavior*? (Hint: No.)

Both the compiler and the programmer are entitled to assume that the
value of x is 42 at the point of the printf call. The compiler could
legally replace the call with puts("x = 42"). If you insert code to
change the value of x, then you've invoked undefined behavior, and
printing "x = 42" is merely one possible consequence.

The compiler is not required to replace references to x with the
constant 42, but it's certainly allowed to do so. (Note that this
might not even be an optimization; depending on the CPU, you might get
faster code by loading the value of x, particularly if it happens to
be stored in a register, than by loading a literal value.)

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #47

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sacha Schär | last post by:
Suppose I have an array of Foo's: class Foo { public: int SomeMethode(void); int i; char c; char * p;
2
by: Mantorok Redgormor | last post by:
When is it that memset caused problems? I recall from posts in the past where someone used memset in their code that invoked undefined behavior. What about the following? char the_array; ...
6
by: bob_jenkins | last post by:
{ const void *p; (void)memset((void *)p, ' ', (size_t)10); } Should this call to memset() be legal? Memset is of type void *memset(void *, unsigned char, size_t) Also, (void *) is the...
21
by: jacob navia | last post by:
Many compilers check printf for errors, lcc-win32 too. But there are other functions that would be worth to check, specially memset. Memset is used mainly to clear a memory zone, receiving a...
43
by: emyl | last post by:
Hi all, here's an elementary question. Assume I have declared two variables, char *a, **b; I can then give a value to a like a="hello world";
18
by: Gaijinco | last post by:
I'm having a headache using memset() Given: int v; memset((void*)v, 1, sizeof(v)); Can I be 100% positive than v = 1 for i 0, or there is something else I have to do?.
6
by: Vincent SHAO | last post by:
int distance; memset(distance,-2,MAX_X*MAX_Y*sizeof(int)); Academically, the buffer "distance" should have been filled with -2 after these two line, but, memset just fail to do the trick, they...
18
by: sam | last post by:
(newbie)Technically what's the difference between memset() and memcpy() functions?
38
by: Bill Cunningham | last post by:
When I want to clear memory space this is what I typically do myself, char a; int i; for (i=0;i != 100;++i) a='\0'; Now with the function memset I could do the same thing and it would be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.